refactor(tui): tighten editor handoff helpers

- editor.ts: collapse two private helpers into one flatMap-driven lookup,
  keep `isExecutable` as the only named primitive, document the fallback
  chain with prompt_toolkit parity
- editor.test.ts: hoist the `exe` helper out of `describe`, drop the
  empty afterEach + dead mkdir branch, materialize expected paths before
  the resolveEditor call so argument evaluation order doesn't bite
- useComposerState.openEditor: rmSync the mkdtemp dir (was leaking),
  early-return on bad exit / empty buffer, run cleanup in finally
- useInputHandlers: cheap `ch.toLowerCase() === 'g'` guard before the
  modifier check
- hermes-ink/screen.ts: pick up `npm run fix` import-sort cleanup so
  lint passes
This commit is contained in:
Brooklyn Nicholson 2026-04-25 20:24:06 -05:00
parent 7fd8dc0bfb
commit 83129e72de
5 changed files with 74 additions and 91 deletions

View file

@ -366,10 +366,9 @@ export function useInputHandlers(ctx: InputHandlerContext): InputHandlerResult {
return voiceRecordToggle()
}
// Alt+G is the escape hatch for terminals that swallow Ctrl+G — VSCode and
// Cursor bind it to "Find Next" by default, so the keystroke never reaches
// the embedded TUI. Alt+G arrives as `\x1bg` → meta+g across platforms.
if (isAction(key, ch, 'g') || (key.meta && ch.toLowerCase() === 'g')) {
// Ctrl+G, plus Alt+G fallback for VSCode/Cursor (they bind Ctrl+G to
// "Find Next" before the TUI sees it; Alt+G arrives as meta+g).
if (ch.toLowerCase() === 'g' && (isAction(key, ch, 'g') || key.meta)) {
return cActions.openEditor()
}