detached 05af959

fix(focus): sync StackedView visibility on stack navigation

commit
05af9591e877b9b1019c19480696d8c2fe81b9d6
author
brice · · 2025-12-15 22:39 UTC
committer
brice · · 2025-12-15 19:52 UTC
parent
8cb6471
signature
unsigned
1 file · +39 -0
M internal/ui/app.go +39 -0
@@ -710,11 +710,50 @@ func (a *App) handlePaneFocus(ctx context.Context, direction usecase.NavigateDir
710710 wsView.FocusPane(newPane.Pane.ID)
711711 }
712712
713+ // Sync StackedView visibility if new pane is in a stack
714+ if newPane.Parent != nil && newPane.Parent.IsStacked {
715+ a.syncStackedViewActive(ctx, wsView, newPane)
716+ }
717+
713718 log.Debug().Str("direction", string(direction)).Str("new_pane_id", newPane.ID).Msg("focus navigated")
714719
715720 return nil
716721 }
717722
723+// syncStackedViewActive updates the StackedView's visibility to match the domain model.
724+// Call this after navigating focus to a pane inside a stack.
725+func (a *App) syncStackedViewActive(ctx context.Context, wsView *component.WorkspaceView, paneNode *entity.PaneNode) {
726+ log := logging.FromContext(ctx)
727+
728+ if paneNode == nil || paneNode.Parent == nil || !paneNode.Parent.IsStacked {
729+ return
730+ }
731+
732+ tr := wsView.TreeRenderer()
733+ if tr == nil {
734+ return
735+ }
736+
737+ // Get the StackedView for this pane
738+ stackedView := tr.GetStackedViewForPane(string(paneNode.Pane.ID))
739+ if stackedView == nil {
740+ log.Warn().Str("pane_id", string(paneNode.Pane.ID)).Msg("stacked view not found for pane")
741+ return
742+ }
743+
744+ // Use the parent's ActiveStackIndex which was set by the focus manager
745+ stackIndex := paneNode.Parent.ActiveStackIndex
746+
747+ log.Debug().
748+ Str("pane_id", string(paneNode.Pane.ID)).
749+ Int("stack_index", stackIndex).
750+ Msg("syncing stacked view visibility")
751+
752+ if err := stackedView.SetActive(ctx, stackIndex); err != nil {
753+ log.Warn().Err(err).Msg("failed to set stacked view active index")
754+ }
755+}
756+
718757 // handleStackPane adds a new pane stacked on top of the active pane.
719758 // This modifies both the domain tree and the UI StackedView.
720759 func (a *App) handleStackPane(ctx context.Context) error {
@@ -710,11 +710,50 @@ func (a *App) handlePaneFocus(ctx context.Context, direction usecase.NavigateDir
710 wsView.FocusPane(newPane.Pane.ID)710 wsView.FocusPane(newPane.Pane.ID)
711 }711 }
712 712
713+ // Sync StackedView visibility if new pane is in a stack
714+ if newPane.Parent != nil && newPane.Parent.IsStacked {
715+ a.syncStackedViewActive(ctx, wsView, newPane)
716+ }
717+
713 log.Debug().Str("direction", string(direction)).Str("new_pane_id", newPane.ID).Msg("focus navigated")718 log.Debug().Str("direction", string(direction)).Str("new_pane_id", newPane.ID).Msg("focus navigated")
714 719
715 return nil720 return nil
716 }721 }
717 722
723+// syncStackedViewActive updates the StackedView's visibility to match the domain model.
724+// Call this after navigating focus to a pane inside a stack.
725+func (a *App) syncStackedViewActive(ctx context.Context, wsView *component.WorkspaceView, paneNode *entity.PaneNode) {
726+ log := logging.FromContext(ctx)
727+
728+ if paneNode == nil || paneNode.Parent == nil || !paneNode.Parent.IsStacked {
729+ return
730+ }
731+
732+ tr := wsView.TreeRenderer()
733+ if tr == nil {
734+ return
735+ }
736+
737+ // Get the StackedView for this pane
738+ stackedView := tr.GetStackedViewForPane(string(paneNode.Pane.ID))
739+ if stackedView == nil {
740+ log.Warn().Str("pane_id", string(paneNode.Pane.ID)).Msg("stacked view not found for pane")
741+ return
742+ }
743+
744+ // Use the parent's ActiveStackIndex which was set by the focus manager
745+ stackIndex := paneNode.Parent.ActiveStackIndex
746+
747+ log.Debug().
748+ Str("pane_id", string(paneNode.Pane.ID)).
749+ Int("stack_index", stackIndex).
750+ Msg("syncing stacked view visibility")
751+
752+ if err := stackedView.SetActive(ctx, stackIndex); err != nil {
753+ log.Warn().Err(err).Msg("failed to set stacked view active index")
754+ }
755+}
756+
718 // handleStackPane adds a new pane stacked on top of the active pane.757 // handleStackPane adds a new pane stacked on top of the active pane.
719 // This modifies both the domain tree and the UI StackedView.758 // This modifies both the domain tree and the UI StackedView.
720 func (a *App) handleStackPane(ctx context.Context) error {759 func (a *App) handleStackPane(ctx context.Context) error {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close