forked from WHC/Hermit
TUI: kitty keyboard protocol, word movement and deletion keys
Query CSI ? u at startup and push the disambiguate flag on the alternate screen when the terminal answers; CSI u reports are mapped back to legacy input (Shift/Ctrl+Enter insert a newline, Ctrl+Backspace deletes a word). Ctrl/Alt+Left/Right move by word, Ctrl/Alt+Delete delete the next word. Our define_key codes move above the range ncurses uses for terminfo extended keys.
This commit is contained in:
@@ -87,6 +87,13 @@ take the agent down.
|
||||
- Bracketed paste needs ncurses (all platforms above).
|
||||
- macOS Terminal.app sends Option+Enter as Esc+Enter only with "Use Option as
|
||||
Meta key"; Ctrl+N always inserts a newline.
|
||||
- Kitty keyboard protocol: at startup the TUI sends `CSI ? u`; if the terminal
|
||||
answers (kitty, WezTerm, foot, Ghostty, WHC Shell, ...) it pushes the
|
||||
"disambiguate" flag (`CSI > 1 u`) on the alternate screen and pops it on
|
||||
exit. That makes Shift+Enter / Ctrl+Enter (newline), Ctrl+Backspace (delete
|
||||
word) and an instant Esc work. Other terminals (and tmux) don't answer and
|
||||
keep the legacy keys. If the TUI is killed, the main screen's keyboard mode
|
||||
is untouched because the flags live on the alternate screen's stack.
|
||||
|
||||
## Acceptance checklist
|
||||
|
||||
|
||||
Reference in New Issue
Block a user