feat(tui): Esc returns to Run from an idle panel; hint strip stops repeating itself - #148
Merged
Conversation
sosidudku1
force-pushed
the
valeryb/esc-back-to-run
branch
from
August 18, 2026 18:50
52e7047 to
f2557f9
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.
What
Once you were inside an Observe/Manage panel there was no way back to the chat
screen except cycling Tab through every remaining sub-tab — Esc did nothing. The
hint strip did not help either: it spent one of its five slots on
[ctrl+b] next panel, which repeated[tab] next panelword-for-word.handlePanelEscapedispatchesui_mode_set: chat.[tab] next panel · [shift+tab] prev panel · [esc] back to Run · [/] commands · [ctrl+c] quit. Ctrl+B still cycles panels, it is just no longer advertised.Precedence
The panel layers keep Esc when they mean something by it.
TuiAppnow threads eachpanel handler's return value into
handlePanelEscape, which fires only when thepanel returned
false(nothing consumed the key) — so a cancel-confirm modal, an opentasks search, a skills hub, a detail view or a half-typed create form still closes
itself first and stays on the panel. The
editorFocusguard covers tabs that leavethe chat editor focused, where Esc already means abort / scroll-reset / quit in the
editor's own hook and must not double-act.
The decision lives in one exported pure function rather than inline in the
useInputcallback so all four branches are directly unit-testable.
Testing
handlePanelEscape(unclaimed Esc →ui_mode_set: chat; panel-claimedEsc → no dispatch; editor-focused → no dispatch; non-Esc keys ignored).
▸ Manageto▸ Run.[esc] back to Runand no longer containsctrl+b.npm run lint(tsc) clean.npx vitest run src/tui --no-file-parallelism: 923 passed, 5 failed — the same 5that fail on
maintoday (tui-app ×2, chat-log, splash-banner, persist-embedding-hybrid-recall).Baseline on main for comparison: 917 passed, same 5 failed.