Skip to content

Commit

Permalink
boxer-sunrise-42 Fixing editor-abort-char? and test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sgithens committed Jan 28, 2022
1 parent 6e3b96c commit 06c72c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
17 changes: 5 additions & 12 deletions src/editor-high/comdef.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tests/comdef-tests.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 06c72c1

Please sign in to comment.