diff --git a/org/channel-tui-main.org b/org/channel-tui-main.org index 71ded14..fcabba0 100644 --- a/org/channel-tui-main.org +++ b/org/channel-tui-main.org @@ -968,8 +968,7 @@ Returns T on success, nil on failure. Does NOT wait or retry." ;; Keyboard reader via read-raw-byte (proven CSI detection) (handler-case (let* ((b (cl-tty.input::read-raw-byte :timeout 0.1)) - (code b) - (esc-seq (and (= code 27) + (esc-seq (and b (= b 27) (let ((b2 (cl-tty.input::read-raw-byte :timeout 0.15))) (when (and b2 (= b2 91)) (let ((t2 (cl-tty.input::read-raw-byte :timeout 0.15))) @@ -981,21 +980,21 @@ Returns T on success, nil on failure. Does NOT wait or retry." (when b (queue-event (list :type :key - :payload (list :code (or code 0) + :payload (list :code b :ch (or esc-seq (cond - ((= code 13) :enter) - ((= code 10) :enter) - ((= code 27) :escape) - ((= code 9) :tab) - ((or (= code 127) (= code 8)) :backspace) - ((and (>= code 1) (<= code 26)) + ((= b 13) :enter) + ((= b 10) :enter) + ((= b 27) :escape) + ((= b 9) :tab) + ((or (= b 127) (= b 8)) :backspace) + ((and (>= b 1) (<= b 26)) (intern (string-upcase (format nil "CTRL-~a" - (code-char (+ #x60 code)))) + (code-char (+ #x60 b)))) :keyword)) - (t code)))))))) + (t b)))))))) (error (c) (add-msg :system (format nil "* Reader error: ~a *" c)))) ;; Check for terminal resize (SIGWINCH sets this flag)