feat(tui): the keybar reflects the focused workspace pane - #90
Merged
Conversation
While the preview holds focus, movement routes to the preview's scroll rather than the list cursor (WorkspaceViewModel.Route), so the bar now says j/k:scroll instead of j/k:move, and advertises C-h:list — a key that only does something from the preview side. The focus change also had to repaint the chrome: Tab/C-h/C-l moved FocusedPane without calling RefreshChrome, so the bar kept the stale pane's verbs. Closes the last open acceptance criterion of #19.
jinyeow
force-pushed
the
feat/keybar-focused-pane
branch
from
July 28, 2026 00:34
9afc30c to
df2c533
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
Issue #19 turned out to be five-sixths already shipped. Walking its six acceptance criteria
against the tree found five implemented and tested under #48/#49 (ADR 0024, released in v0.4.0) —
the ticket was simply never closed. One sub-clause was genuinely missing:
It didn't, and it couldn't have:
KeybarFormatter.Renderwas called withActiveScope(derivedonly from
ShellViewModel.ActiveSection) andPreviewVisible.WorkspaceViewModel.FocusedPanenever reached it.
Chasing that turned up a second defect the ticket never named:
Dispatch'sApplyWorkspaceFocusarm moved focus without callingRefreshChrome, so even a focus-awareformatter would have kept painting the previous pane's keys until some unrelated event repainted
the bar.
j/kdoj/k:movej/k:scrollC-hback to the listC-h:listTab+9 tests (1,409 → 1,418) for ~36 changed source lines. The cost is one new required parameter on
KeybarFormatter.Renderand 13 call-site updates in its tests.Closes #19.
What changed
App/KeybarFormatter.cs—Rendertakes a requiredWorkspacePane focusedPane. Required, notdefaulted, matching the existing reasoning on
previewVisible: advertisement must not be able todrift from behaviour because a caller forgot to say which state it is in.
App/CobaltShell.cs:349—RefreshChrome()in theApplyWorkspaceFocusarm.SetIfChangedmakes it a no-op when the text is unchanged.
Why only those two entries change
ShellCommandRouter.VerbKind:131-149never branches onFocusedPane— only on the active section.So
o:open,c:comment,v:vote,q/hgenuinely behave identically in both panes and aredeliberately left alone.
C-hearned a conditional entry becauseWorkspaceViewModel.FocusLeft:46-54is a no-op when the list already holds focus, so advertising it unconditionally would be a false hint.
Verification
The shell-level test is the real proof of the criterion:
The_Keybar_Reflects_The_Focused_Pane— RED because after aTabkeypress movedFocusedPanetoPreview,KeybarTextstill readj/k:move.All 13 existing
KeybarFormatterTestscall sites gained the new argument; no assertion waschanged. Clean Release build, 0 warnings / 0 errors; 1,418 tests (391 Core + 1,027 Tui).
Known, not fixed here
Whenever the preview shows, the bar renders
Tab:tab(the deadNextTab) alongsideTab:switch list / preview— two entries for one key, one of which does nothing. It tracks previewvisibility, not focus, so it sits outside this criterion. Worth its own ticket.