Classify every comment as tautology, stale, excuse or decision record. Tautology/stale/excuse comments are deleted (excuses filed as issues #196-#236), decisions moved to docs/adr/0001-0034. - scripts/lint-comments.sh + .comment-baseline: per-file comment count may only go down; wired into tests/all.sh - .claude/skills/delete-comment: repeatable audit workflow - cargo fmt applied to touched crates Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1.6 KiB
Terminal input modes, paste handling and redraw throttle
Status: accepted
Context
Shift-enter must insert a newline, but terminals disagree on how to report it. The kitty keyboard protocol reports Enter+SHIFT (ghostty, kitty, wezterm, iTerm2, foot, alacritty, zellij). tmux does not speak that protocol: it forwards shift-enter only after the app requests xterm-style modifyOtherKeys, and as ESC[13;2u only with extended-keys-format csi-u. Terminals that do not answer the keyboard-enhancement query return false. Pasted text can contain ESC and other control characters. Terminals without bracketed paste deliver a paste as a flood of key events.
Decision
- Query keyboard-enhancement support before entering the alternate screen; push the kitty flags on the alternate screen only when the terminal answered.
- Under tmux without kitty support, send the modifyOtherKeys request instead.
- Install a panic hook that pops the keyboard flags and disables bracketed paste, so a crash does not leave the shell in that mode.
- Enable bracketed paste so a paste arrives as one Paste event (no redraw per char, newlines do not submit).
- Strip ESC and similar control chars from pasted text so pasted escape sequences cannot act on the terminal.
- Redraw at most about 60 times per second (16 ms frame), so input stays ahead of the redraw when a paste arrives as key events.
Consequences
Shift-enter works across the listed terminals and tmux when configured. Terminal state is restored after a panic. Redraws can lag up to one frame.
Code: crates/hx-tui/src/lib.rs:run (setup before event loop, FRAME), crates/hx-tui/src/editor.rs:insert (paste sanitising)