Add scrolling region and text attribute functions to editor

This commit is contained in:
John Lorentzson 2025-07-18 17:50:16 +02:00
parent 3b59b0ce00
commit ea4b8c3d99

View file

@ -145,6 +145,18 @@ serial connection the editor normally runs under.")
(write-char #\K *eio*) (write-char #\K *eio*)
(force-output *eio*)) (force-output *eio*))
(defun set-scrolling-region (&optional top bottom)
(assert (or (and (typep top 'integer) (typep bottom 'integer))
(and (null top) (null bottom))))
(cond ((and top bottom)
;; Set the region
(write-byte #x1B *eio*)
(format *eio* "[~D;~Dr" top bottom))
(t
;; Reset the region to fullscreen
(write-byte #x1B *eio*)
(format *eio* "[1;24r"))))
(defun scroll-screen-down (&optional (amount 1)) (defun scroll-screen-down (&optional (amount 1))
(write-byte #x1B *eio*) (write-byte #x1B *eio*)
(write-char #\[ *eio*) (write-char #\[ *eio*)
@ -165,6 +177,14 @@ serial connection the editor normally runs under.")
(write-byte #x1B *eio*) (write-byte #x1B *eio*)
(write-string "[?25h" *eio*)) (write-string "[?25h" *eio*))
(defun invert-text ()
(write-byte #x1B *eio*)
(write-string "[7m" *eio*))
(defun reset-text-attributes ()
(write-byte #x1B *eio*)
(write-string "[m" *eio*))
(defparameter +screen-width+ 80) (defparameter +screen-width+ 80)