Skip to content

Conversation

@sreya
Copy link
Contributor

@sreya sreya commented Dec 4, 2025

fixes #79

Arrow keys now correctly send SS3 sequences (ESC O A/B/C/D) when
application cursor mode is enabled (DEC mode 1), and CSI sequences
(ESC [ A/B/C/D) when in normal mode.

This fixes arrow key navigation in applications like htop that enable
application cursor mode.

Changes:
- Rewrote Key enum to match Ghostty's internal values (was using USB HID codes)
- Arrow keys now go through the Ghostty encoder instead of fast path
- Sync encoder CURSOR_KEY_APPLICATION option with terminal mode 1 state
- Add getModeCallback to InputHandler for querying terminal mode state
- Add tests for both normal and application cursor modes

The Key enum change also fixes the encoder for all special keys (F-keys,
navigation keys, etc.) which were previously producing incorrect or empty
output due to the enum value mismatch.
@sreya sreya force-pushed the fix-htop-arrow-keys branch from 3210ee4 to e6aa575 Compare December 4, 2025 07:01
@sreya sreya merged commit 22f6d09 into main Dec 4, 2025
5 checks passed
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.

Arrow keys in htop doesn't work

1 participant