feat: add --sidebar flag to control sidebar visibility#2917
Conversation
86795cf to
28ccdc0
Compare
28ccdc0 to
8bd6368
Compare
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The implementation is clean and correct. All hypotheses were investigated and dismissed:
AllBindings() guard change — The comment "leanMode already returned above" is accurate: there is an explicit early-return if m.leanMode { return []key.Binding{quitBinding} } at the top of the function. The prior if !m.leanMode guard on the Ctrl+b binding was therefore always true and redundant. Replacing it with if !m.hideSidebar is the correct change. (The previous commit message even says "simplify AllBindings: remove redundant leanMode guard", confirming intent.)
Mouse interaction when hideSidebar=true — computeSidebarLayout() returns a layout with sidebarHeight=0 (zero value) and showToggle()==false when hidden. The hit-test y < sl.sidebarHeight (i.e. y < 0) is never true, so no mouse click can reach the sidebar target. The sidebar cannot be re-enabled by clicking.
--sidebar flag default true — Cobra's BoolVar writes the default value immediately at registration time, not at parse time. f.sidebar is true before any command runs, so !f.sidebar is always false at call time unless the user explicitly passes --sidebar=false. No issue.
hideSidebar vs leanMode height difference in View() — Intentional by design: lean mode hides all chrome (no fixed height constraint needed), while --sidebar=false keeps the tab bar and status bar (requires chatHeight constraint). The hideSidebar branch correctly mirrors the default collapsed-sidebar branch.
The sidebarHidden() helper cleanly centralises the guard, WithHideSidebar() correctly disables the keymap binding, and the ToggleSidebarMsg gate in tui.go provides defence-in-depth. Looks good to merge.
Closes #2912
Adds a
--sidebarflag to control sidebar visibility in the TUI. When set to--sidebar=false, the sidebar is hidden and the user cannot re-enable it via keyboard shortcut or mouse interaction. The flag defaults totrue, preserving existing behavior.This complements the existing
--leanflag, which hides the entire UI chrome. The--sidebar=falseoption is lighter—it keeps the tab bar, status bar, and dialogs intact while hiding only the sidebar. The implementation gates the Ctrl+B keybinding and sidebar toggle behavior when the sidebar is disabled, and adjusts the chat layout to fill the full width when the sidebar is absent.Build, lint, and tests all pass. (Unrelated pre-existing failures in
pkg/snapshoton macOS stem from/private/varsymlink handling and are out of scope.)