Skip to content

feat(tui): Esc returns to Run from an idle panel; hint strip stops repeating itself - #148

Merged
sosidudku1 merged 2 commits into
mainfrom
valeryb/esc-back-to-run
Aug 18, 2026
Merged

feat(tui): Esc returns to Run from an idle panel; hint strip stops repeating itself#148
sosidudku1 merged 2 commits into
mainfrom
valeryb/esc-back-to-run

Conversation

@plombeer31

Copy link
Copy Markdown
Collaborator

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 panel word-for-word.

  1. Esc goes home. After the active panel's own key layer declines the key,
    handlePanelEscape dispatches ui_mode_set: chat.
  2. The freed hint slot pays for it. The debug footer now reads
    [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. TuiApp now threads each
panel handler's return value into handlePanelEscape, which fires only when the
panel returned false (nothing consumed the key) — so a cancel-confirm modal, an open
tasks search, a skills hub, a detail view or a half-typed create form still closes
itself first and stays on the panel. The editorFocus guard covers tabs that leave
the 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 useInput
callback so all four branches are directly unit-testable.

Testing

  • 4 unit tests on handlePanelEscape (unclaimed Esc → ui_mode_set: chat; panel-claimed
    Esc → no dispatch; editor-focused → no dispatch; non-Esc keys ignored).
  • 1 Ink test: Esc on an idle Manage/Tasks panel moves the nav marker from ▸ Manage to ▸ Run.
  • 1 hint-strip test: the debug footer contains [esc] back to Run and no longer contains ctrl+b.
  • All 6 verified to fail against unpatched code.
  • npm run lint (tsc) clean.
  • Full npx vitest run src/tui --no-file-parallelism: 923 passed, 5 failed — the same 5
    that fail on main today
    (tui-app ×2, chat-log, splash-banner, persist-embedding-hybrid-recall).
    Baseline on main for comparison: 917 passed, same 5 failed.

@sosidudku1
sosidudku1 force-pushed the valeryb/esc-back-to-run branch from 52e7047 to f2557f9 Compare August 18, 2026 18:50
@sosidudku1
sosidudku1 merged commit b6345f9 into main Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants