From 0da45020dbb72f213eeaf9e32e348479694bddd0 Mon Sep 17 00:00:00 2001 From: John Lorentzson Date: Mon, 28 Jul 2025 16:19:38 +0200 Subject: [PATCH] Fix bug in editor's CSI dispatch causing errors on some unknown keys --- editor/editor.lisp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/editor/editor.lisp b/editor/editor.lisp index ba6a2cd..a871733 100644 --- a/editor/editor.lisp +++ b/editor/editor.lisp @@ -808,11 +808,14 @@ Additionally ensures correct line numbers on the way, as a bonus." (defun csi-handler () (loop :for buffer := '() :then (append buffer (list (read-char *eio*))) :for found := (assoc buffer *csi-sequences* :test #'equalp) - :when (or found (not (zerop (some - (lambda (c) - (search buffer (car c))) - *csi-sequences*)))) - :return (cadr found))) + :for match-point := (some + (lambda (c) + (search buffer (car c))) + *csi-sequences*) + :when (or found (null match-point) + (and (numberp match-point) + (not (zerop match-point)))) + :return (or (cadr found) :unknown))) (defun esc (key) (when (numberp key)