From 06c72c1a13606a4e9fd77d0d87a7f8b632a0948e Mon Sep 17 00:00:00 2001 From: Steven Githens Date: Fri, 28 Jan 2022 09:04:56 -0800 Subject: [PATCH] boxer-sunrise-42 Fixing editor-abort-char? and test cases --- src/editor-high/comdef.lisp | 17 +++++------------ tests/comdef-tests.lisp | 6 ++++-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/editor-high/comdef.lisp b/src/editor-high/comdef.lisp index 38d55864..46d259d2 100644 --- a/src/editor-high/comdef.lisp +++ b/src/editor-high/comdef.lisp @@ -735,18 +735,11 @@ Modification History (most recent at top) ; (reset-mouse-cursor) ; (setq *suitcase-mode* nil)) -(defvar *editor-abort-chars* #\c) ; sgithens TODO March 7, 2020 - ;; #-mcl (list (make-char #\g 1) (make-char #\. 1) - ;; ;; 200. is the STOP key on Suns - ;; #+sun (make-char (code-char 200)) - ;; #+sun (make-char (code-char 200) 1)) - ;; ;; MCL can't encode shift bits in character objects - ;; #+mcl (list #\Bell)) - -(defun editor-abort-char? (char &optional bits) - (declare (ignore bits)) - (and (characterp char) - (or (member char *editor-abort-chars* :test #'char-equal)))) +(defvar *editor-abort-chars* '((#\g 2) (#\. 2))) + +(defun editor-abort-char? (ch &optional (bits 0)) + (let ((keystroke (list ch bits))) + (if (member keystroke *editor-abort-chars* :test #'equal) t nil))) ;; used in keydef-high (defvar *defined-input-device-platforms* nil diff --git a/tests/comdef-tests.lisp b/tests/comdef-tests.lisp index 9ab94bc9..dac83ea6 100644 --- a/tests/comdef-tests.lisp +++ b/tests/comdef-tests.lisp @@ -12,9 +12,11 @@ (is (boxer::editor-abort-char? #\c 1) nil) -(is (boxer::editor-abort-char? #\g 1) t) +(is (boxer::editor-abort-char? #\c 2) nil) -(is (boxer::editor-abort-char? #\. 1) t) +(is (boxer::editor-abort-char? #\g 2) t) + +(is (boxer::editor-abort-char? #\. 2) t) (finalize)