hermes-agent/ui-tui/src/__tests__
brooklyn! 44b63fc6de
fix(tui): allow transcript scroll + Esc during approval/clarify/confirm prompts (#26414)
When an approval / clarify / confirm overlay was active, the global input
handler in useInputHandlers returned for every key that wasn't Ctrl+C, which
silently disabled transcript scrolling. On long threads the context the
prompt was asking about often lived above the visible viewport, and being
unable to scroll while answering felt like the prompt had locked the UI.
ApprovalPrompt also had no Esc handler at all, so the one obvious 'abort'
key did nothing during a permission prompt and the user had to memorize
Ctrl+C or hunt for the deny number.

Fixes:

- Extract shouldFallThroughForScroll(key) (pure, exported) covering wheel
  scrolls, PageUp/PageDown, and Shift+ArrowUp/Down. When a prompt overlay
  is up and the pressed key is a scroll input, skip the early return so it
  reaches the existing wheel/PageUp/Shift+arrow handlers below. Plain
  arrows still drive in-prompt selection — they don't fall through.
- ApprovalPrompt now maps Esc to onChoice('deny'), parity with the global
  Ctrl+C cancellation path that already invokes cancelOverlayFromCtrlC()
  for approvals. The bottom-of-prompt hint now advertises 'Esc/Ctrl+C deny'.
- Extract approvalAction(ch, key, sel) — pure key-dispatch helper for the
  approval prompt, exported so the regression matrix (Esc, numbers, Enter,
  arrows, edge clamping, precedence) is testable without mounting Ink.

Tests:
- useInputHandlers.test.ts: 6 cases covering shouldFallThroughForScroll
  positives (wheel/PageUp/PageDown/Shift+arrows) and negatives (plain
  arrows, bare shift, no scroll key).
- approvalAction.test.ts: 8 cases covering Esc→deny, numeric mapping,
  Enter, ↑↓ within bounds, edge clamping, Esc-beats-others precedence,
  unrelated keystrokes.
2026-05-15 21:59:28 -05:00
..
approvalAction.test.ts fix(tui): allow transcript scroll + Esc during approval/clarify/confirm prompts (#26414) 2026-05-15 21:59:28 -05:00
asCommandDispatch.test.ts fix(tui): slash.exec _pending_input commands, tool ANSI, terminal title 2026-04-18 09:30:48 -07:00
clipboard.test.ts fix(tui): improve clipboard copy fallbacks 2026-05-05 03:59:00 -07:00
constants.test.ts test(tui): tighten redraw hotkey review follow-ups 2026-04-27 12:30:40 -05:00
createGatewayEventHandler.test.ts fix(tui): handle timeout/error subagent statuses in /agents (#26687) 2026-05-15 20:19:02 -05:00
createSlashHandler.test.ts fix: keep tui /quit behavior aligned with cli exit flow 2026-05-08 16:48:24 -07:00
details.test.ts fix(tui): apply details mode live 2026-04-26 13:34:33 -05:00
emoji.test.ts fix(tui): inject VS16 so text-default emoji render as color glyphs 2026-04-21 15:52:39 -05:00
externalLink.test.ts feat(ui-tui): resolve markdown links to readable page titles (#24013) 2026-05-11 14:16:31 -07:00
forceTruecolor.test.ts fix(tui): normalize legacy Terminal.app colors (#17695) 2026-04-29 20:13:49 -07:00
gatewayClient.test.ts feat(tui): support attaching to an existing gateway (#21978) 2026-05-08 12:12:38 -07:00
markdown.test.ts feat(ui-tui): resolve markdown links to readable page titles (#24013) 2026-05-11 14:16:31 -07:00
mathUnicode.test.ts fix: account for latex 2026-04-28 21:20:43 -04:00
messages.test.ts fix(tui): preserve prompt separator width (#19340) 2026-05-04 09:58:40 -07:00
osc52.test.ts fix(tui): raise picker selection contrast with inverse + bold 2026-04-21 14:31:21 -05:00
paths.test.ts feat(tui): append git branch to cwd label in status bar 2026-04-18 17:17:05 -05:00
platform.test.ts fix(tui): respect voice.record_key config (supersedes #19028, #19339) (#19835) 2026-05-04 15:49:28 -07:00
precisionWheel.test.ts fix(tui): steady transcript scrollbar (#20917) 2026-05-06 14:50:31 -07:00
providers.test.ts chore(tui): /clean pass — inline one-off locals, tighten ConfirmPrompt 2026-04-19 07:55:38 -05:00
reasoning.test.ts fix(tui): filter thinking status noise 2026-04-26 13:59:56 -05:00
rpc.test.ts fix(ui-tui): surface RPC errors and guard invalid gateway responses 2026-04-13 14:17:52 -05:00
scroll.test.ts fix(tui): refresh scroll height at cached bottom 2026-05-07 05:48:19 -07:00
slashParity.test.ts test(tui): skip slash parity matrix when Python registry is unavailable 2026-04-27 13:19:11 -05:00
spawnHistoryStore.test.ts fix(tui): handle timeout/error subagent statuses in /agents (#26687) 2026-05-15 20:19:02 -05:00
stateIsolation.test.ts fix(tui): isolate turn state from app render 2026-04-26 15:40:38 -05:00
statusBarTicker.test.ts feat(tui): segment turns with rule above non-first user msgs; trim ticker dead space (#21846) 2026-05-08 05:12:09 -07:00
streamingMarkdown.test.ts Merge remote-tracking branch 'origin/main' into fix/markdown 2026-04-28 22:01:02 -04:00
subagentTree.test.ts style(debug): add missing blank line between LogSnapshot and helpers 2026-04-22 16:34:05 -05:00
syntax.test.ts fix(tui): restore macOS copy behavior and theme polish (#17131) 2026-04-28 18:47:14 -05:00
terminalModes.test.ts fix(tui): tighten SGR fragment matching 2026-04-30 17:50:49 -05:00
terminalParity.test.ts fix(tui): restore macOS copy behavior and theme polish (#17131) 2026-04-28 18:47:14 -05:00
terminalSetup.test.ts style(tui): apply npm run fix 2026-04-28 22:18:26 -05:00
text.test.ts perf(tui): cache stringWidth/wrapText/sliceAnsi + skip-slice when line fits clip 2026-04-26 19:28:09 -05:00
textInputFastEcho.test.ts fix(tui): restrict fast-echo bypass to ASCII so Vietnamese/CJK/IME input renders correctly (#26011) 2026-05-15 09:41:50 -05:00
textInputLineNav.test.ts fix(tui): up-arrow inside a multi-line buffer moves cursor, not history 2026-04-21 18:31:35 -05:00
textInputPassThrough.test.ts fix(tui): respect voice.record_key config (supersedes #19028, #19339) (#19835) 2026-05-04 15:49:28 -07:00
textInputRightClick.test.ts fix(tui): right-click copies selection, only pastes when no selection 2026-05-10 16:06:33 -07:00
textInputWrap.test.ts fix(tui): word-wrap composer input (#17651) 2026-04-29 16:55:49 -07:00
theme.test.ts fix(tui): honor skin highlight colors (#20895) 2026-05-06 14:01:56 -07:00
turnStore.test.ts chore(tui): remove dead branch cleanup code 2026-04-26 21:54:24 -05:00
useCompletion.test.ts fix(tui): complete absolute paths as paths 2026-05-04 16:14:40 -07:00
useComposerState.test.ts fix(tui): raise picker selection contrast with inverse + bold 2026-04-21 14:31:21 -05:00
useConfigSync.test.ts fix(tui): respect voice.record_key config (supersedes #19028, #19339) (#19835) 2026-05-04 15:49:28 -07:00
useInputHandlers.test.ts fix(tui): allow transcript scroll + Esc during approval/clarify/confirm prompts (#26414) 2026-05-15 21:59:28 -05:00
useQueue.test.ts fix(tui): copilot review on #16707 — naming, label consistency, esc priority 2026-04-27 15:37:54 -05:00
useSessionLifecycle.test.ts fix(tui): report actual session on exit 2026-04-27 08:52:12 -07:00
useVirtualHistoryHeights.test.ts perf(tui): lazily seed virtual history heights (#16523) 2026-04-27 07:55:45 -07:00
viewport.test.ts fix(tui): stabilize sticky prompt tracking 2026-04-28 22:10:40 -05:00
viewportStore.test.ts fix(tui): steady transcript scrollbar (#20917) 2026-05-06 14:50:31 -07:00
virtualHeights.test.ts feat(tui): segment turns with rule above non-first user msgs; trim ticker dead space (#21846) 2026-05-08 05:12:09 -07:00
virtualHistoryClamp.test.ts fix(tui): stabilize live progress rendering 2026-04-26 15:23:43 -05:00
virtualHistoryOffsetCache.test.ts fix(tui): refresh virtual offsets after row resize (#20898) 2026-05-06 13:54:46 -07:00
wheelAccel.test.ts chore(tui): /clean recent perf work — KISS/DRY pass 2026-04-26 20:38:47 -05:00