Skip to content

fix: bind shift+tab (CSI Z backtab) escape sequence - #15

Merged
TimoKramer merged 1 commit into
TimoKramer:mainfrom
kpassapk:fix/shift-tab-backtab
Jul 21, 2026
Merged

fix: bind shift+tab (CSI Z backtab) escape sequence#15
TimoKramer merged 1 commit into
TimoKramer:mainfrom
kpassapk:fix/shift-tab-backtab

Conversation

@kpassapk

Copy link
Copy Markdown
Contributor

What

Terminals send ESC [ Z for shift+tab (backtab), but the keymap had no binding for it, so backtab presses arrived as unknown events and could not be matched with (msg/key-match? msg "shift+tab"). This binds [Z to {:type :tab :shift true} alongside the other special keys.

Why

Found while building a form wizard on charm.clj: Tab moved focus forward but shift+tab could not move it backward, since the event never reached the update function as a key press.

Testing

  • Unit test in keys_test.clj (parse-escape-sequence on [Z), following the focus-events pattern
  • Integration test in integration/input_test.clj (read-event on \u001b[Z via the dumb-terminal harness), following the plain-tab pattern
  • bb test (JVM) and bb test:bb: 152 tests, 940 assertions, 0 failures; bb format and bb lint clean
  • Verified interactively in a real TUI: shift+tab now matches "shift+tab" in key-match? and cycles focus backward

🤖 Generated with Claude Code

@kpassapk
kpassapk force-pushed the fix/shift-tab-backtab branch 2 times, most recently from 9bb7756 to 7659d3d Compare July 20, 2026 18:10
Terminals send ESC [ Z for shift+tab, but the keymap had no binding
for it, so backtab presses arrived as unknown events and could not be
matched with (key-match? msg "shift+tab"). Bind [Z to
{:type :tab :shift true} alongside the other special keys.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kpassapk
kpassapk force-pushed the fix/shift-tab-backtab branch from 7659d3d to f13ddfc Compare July 20, 2026 18:10
@TimoKramer
TimoKramer merged commit aa6a75e into TimoKramer:main Jul 21, 2026
2 checks passed
@TimoKramer

Copy link
Copy Markdown
Owner

Thank you!

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