Skip to content

Conversation

@streamtechteam
Copy link

@streamtechteam streamtechteam commented Oct 1, 2025

TLDR

Based on gemini cli code , I fixed arrow keys problem in ghostty and kitty terminals

Now enabling num lock or caps lock doesnt make any diffrence and everything works fine

Dive Deeper

  • Add prefix “peel-and-continue” parser to consume one complete sequence at a time, preventing buffer overflow and stray fragments
  • Support parameterized functional keys ESC[1;NmX]:
  • Arrows A/B/C/D → up/down/right/left
  • Home/End H/F → home/end
  • F1–F4 P/Q/R/S → f1/f2/f3/f4
  • Handle reverse Tab as Shift+Tab:
  • Legacy ESC[Z
  • Parameterized ESC[1;2Z
  • Accept legacy arrows ESC[A/B/C/D] when Kitty is enabled (no modifiers).
  • Map tilde-coded CSI sequences (ESC[~):
  • 1 → home, 2 → insert, 3 → delete, 4 → end, 5 → pageup, 6 → pagedown
  • Fixes spillage like “9~” on Delete by consuming the full sequence.
  • Raise MAX_KITTY_SEQUENCE_LENGTH from 12 → 32.
  • Normalize modifiers when “event types” bit is set (>=128) and introduce named bit constants:
  • MODIFIER_SHIFT_BIT, MODIFIER_ALT_BIT, MODIFIER_CTRL_BIT
  • Improve readability: symbol→name lookup table and inline regex comments.

Reviewer Test Plan

  1. Run test suite
  2. Recreate using user setups from Arrow keys not working in kitty #580

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker
Podman - -
Seatbelt - -

Linked issues / bugs

#580

@streamtechteam streamtechteam changed the title Fixed Arrow Key not working on ghostty and kitty Fixed Arrow Key not working on ghostty and kitty (mostly when Num lock is on ) Oct 1, 2025
@streamtechteam streamtechteam changed the title Fixed Arrow Key not working on ghostty and kitty (mostly when Num lock is on ) Fixed Arrow Key not working on ghostty and kitty (mostly when Num lock or Caps Lock is on ) Oct 1, 2025
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.

1 participant