fix: disable kitty keyboard, fix CSI parser crashes

- Disabled \033[?u kitty keyboard protocol in modern-backend
  (converts all keys to escape sequences, breaking Ctrl+letter dispatch)
- Fixed parse-csi-sequence: use multiple-value-bind instead of let*
  with destructuring-bind (lost secondary return value from read-param)
- Fixed parse-csi-params format string: pass char-code of terminator
  as distinct argument for ~d, keeping the character for ~C
- Added %query-terminal-size in classes.lisp: ANSI CSI 18t fallback
  for terminal size detection when ioctl fails or returns zero
This commit is contained in:
2026-05-14 09:31:09 -04:00
parent e8b37f6268
commit 14b41831c3
4 changed files with 50 additions and 14 deletions

View File

@@ -127,14 +127,16 @@ as a fallback when a keyword is not in *named-colors*.")
(backend-write b (format nil "~C[?1002h" #\Esc)) ; mouse drag
(backend-write b (format nil "~C[?1006h" #\Esc)) ; SGR mouse
(backend-write b (format nil "~C[?2004h" #\Esc)) ; bracketed paste
(backend-write b (format nil "~C[?u" #\Esc)) ; kitty keyboard
;; Kitty keyboard protocol disabled — converts all keys to CSI u-sequences
;; which the TUI's key mapping doesn't handle for Ctrl+letter combos.
;; (backend-write b (format nil "~C[?u" #\Esc))
(cursor-hide b)
(finish-output (backend-output-stream b))
b)
(defmethod shutdown-backend ((b modern-backend))
(cursor-show b)
(backend-write b (format nil "~C[?u" #\Esc))
;; (backend-write b (format nil "~C[?u" #\Esc)) ; disabled — never enabled
(backend-write b (format nil "~C[?2004l" #\Esc))
(backend-write b (format nil "~C[?1006l" #\Esc))
(backend-write b (format nil "~C[?1002l" #\Esc))
@@ -156,7 +158,7 @@ as a fallback when a keyword is not in *named-colors*.")
(backend-write b (format nil "~C[?1002h" #\Esc)) ; mouse drag
(backend-write b (format nil "~C[?1006h" #\Esc)) ; SGR mouse
(backend-write b (format nil "~C[?2004h" #\Esc)) ; bracketed paste
(backend-write b (format nil "~C[?u" #\Esc)) ; kitty keyboard
;; (backend-write b (format nil "~C[?u" #\Esc)) ; kitty keyboard — disabled
(cursor-hide b)
(finish-output (backend-output-stream b))
(values))
@@ -173,6 +175,7 @@ as a fallback when a keyword is not in *named-colors*.")
(values (sb-alien:deref winsize 1) ;; cols
(sb-alien:deref winsize 0))) ;; rows
(sb-alien:free-alien winsize))))
(%query-terminal-size)
(values 80 24)))
(defmethod backend-write ((b modern-backend) string)