fix(tui): let Tab indent a multi-line Playbook selection; C-o focuses the menu - #1240
Merged
Conversation
… the menu The selection action menu claimed bare Tab to focus itself, shadowing the editor's 'Tab nests every list line the selection spans' (spec 0094) exactly when a selection exists — which is the only time multi-line nesting is possible. S-Tab was not claimed, so the pair was asymmetric: a selected block could be un-nested but not nested (issue #1106). - The unfocused menu now claims C-o instead of Tab; Tab and S-Tab both reach the editor's indent commands while the menu is merely shown. Menu-internal navigation (Up/Down/Tab/BackTab once focused, Esc to unfocus) is unchanged. - The passive menu advertises the chord with a dim ' C-o menu ' bottom border title, so the focus model is discoverable (also the discoverability half of issue #1092). - New spec 0196 records the focus model: a passive popup may not steal keys the surface underneath documents; the focus chord must be advertised on the menu frame. - Tests: the old test asserting Tab-focuses-the-menu is replaced by the issue's repro (Tab indents the selected lines, S-Tab un-nests them, the menu never steals focus), a C-o-focuses test, a hint-render assertion, and the remaining menu tests drive focus via C-o. Closes #1106
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.
Closes #1106.
Spec 0094 gives Tab / S-Tab list nesting that operates on every list line the selection spans — but the selection action menu claimed bare
Tabfirst, to focus itself, so the multi-line half was unreachable.S-Tabwasn't claimed, leaving the pair asymmetric: a selected block could be un-nested but never nested.What changed
crates/cli/src/app/editor.rs— the unfocused menu now claimsC-oinstead ofTab. While the menu is merely shown, every editing key — includingTab/S-Tabindent over the selection — keeps reaching the editor. Once focused, menu behavior is unchanged (Up/Down/Tab/BackTabcycle rows,Escunfocuses,Enterruns).Why
C-o: reliable in every terminal (unlikeM-Enter, which dies on macOS terminals not configured to send Option as Meta), free in the playbook keymap, and consistent with the editor's emacs-flavored chord family. OnlyC-xchords are claimed globally, so there's no collision.crates/cli/src/ui.rs— the passive menu advertises the chord: a dimC-o menubottom-border title, shown only while unfocused. This also closes the discoverability half of #1092 (nothing on the menu ever said how to reach it); #1092's remaining half (whatEntershould do while the menu is passive) is deliberately left to that issue.specs/0196-playbook-selection-menu-focus-model.md— records the rule: a passive popup may not steal keys the surface underneath documents, and the focus chord must be advertised on the menu frame.Acceptance criteria from the issue
Tabwith a multi-line selection indents every list line the selection spans (repro test:- one\n- two\n- threewith lines 1–2 selected → both nest)S-Tabkeeps outdenting the same lines (asserted on the remapped selection right after the indent)C-o, rendered on the menu; render test asserts the hint)Testing
playbook_tab_focuses_selection_menu_for_multi_line_selectiontest (which enshrined the bug) with the issue's repro + aC-o-focuses test.Tabas the focus vehicle (comment editing, emacs keys, verb navigation, render highlight) toC-o.cargo test -p construct-cli --bin construct playbook: 333 passed. Full workspace suite running before merge.🤖 Generated with Claude Code