Skip to content

fix(input): recognize PowerShell / modifyOtherKeys / Kitty Shift+Tab variants#386

Merged
esengine merged 1 commit intomainfrom
fix/373-shift-tab-powershell
May 7, 2026
Merged

fix(input): recognize PowerShell / modifyOtherKeys / Kitty Shift+Tab variants#386
esengine merged 1 commit intomainfrom
fix/373-shift-tab-powershell

Conversation

@esengine
Copy link
Copy Markdown
Owner

@esengine esengine commented May 7, 2026

Closes #373.

Why

Reasonix only recognized the bare xterm back-tab \x1b[Z. Windows reporters confirmed Shift+Tab does nothing on PowerShell 7.x — the edit-mode cycle silently drops because the input never matches key.shift && key.tab.

Three other Shift+Tab encodings are common in the wild and ALL are emitted by configurations Reasonix already enables:

Encoding Source
\x1b[1;2Z xterm-style modifier-encoded back-tab — emitted by some PowerShell hosts
\x1b[27;2;9~ modifyOtherKeys level 2 (we enable via \x1b[>4;2m at startup)
\x1b[9;2u Kitty keyboard protocol (Ink 7's optional handshake)

What changes

  • src/cli/ui/stdin-reader.tsCSI_TAIL_MAP gains 1;2Z, 27;2;9~, 9;2u entries (all → { shift: true, tab: true }).
  • src/cli/ui/key-normalize.tsCSI_TAIL_TO_FLAGS gains the same three forms so the Ink fallback path matches when useInput doesn't pre-structure them.

Tests

  • tests/key-normalize.test.ts — 2 new cases (PowerShell variant + modifyOtherKeys / Kitty forms).
  • tests/stdin-reader.test.ts — 2 new cases (matching round-trip through the reader).

Test plan

  • npm run verify — 133 files / 2145 passed / 1 skipped (was 2141, +4 new)
  • Manual: PowerShell 7.x on Windows Terminal — Shift+Tab cycles edit modes
  • Manual: PowerShell on conhost (legacy console host) — Shift+Tab cycles edit modes (best-effort; some hosts intercept)

If a terminal emits a form we still don't recognize, /mode continues to work as a typed fallback.

…variants (#373)

Recognized only the bare xterm `\x1b[Z` back-tab. PowerShell 7.x on
some Windows hosts emits the modifier-encoded `\x1b[1;2Z`; modern
Windows Terminal in modifyOtherKeys mode (which we enable on
startup) emits `\x1b[27;2;9~`; the Kitty keyboard envelope is
`\x1b[9;2u`. None of these matched, so the edit-mode cycle was
silently dropped on PowerShell.

Add all three variants to `stdin-reader.ts` CSI_TAIL_MAP and to the
Ink-fallback `key-normalize.ts` recovery table. `/mode` slash command
remains as a typed fallback for any future terminal that emits a
form we haven't seen yet.
@esengine esengine merged commit 28119ca into main May 7, 2026
3 checks passed
@esengine esengine deleted the fix/373-shift-tab-powershell branch May 7, 2026 14:10
@esengine esengine mentioned this pull request May 7, 2026
6 tasks
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.

Shift+Tab doesn't cycle edit mode on Windows PowerShell 7.1

1 participant