v1.0.0 release
Bug fixes:
- Fix OSC8 format strings (backslash escape layering) in modern-backend.org
- Test format string had single backslash instead of double, causing
unclosed CL string that cascaded through 3 subsequent test forms
- Implementation format string had leading escaped quote (not a string
opener) and triple-backslash ending (also not a string terminator)
- Fix missing closing parens in border-char-rounded and border-char-double tests
- Fix ASDF input-tests pathname (file lives in tests/, not src/components/)
New features:
- Implement suspend-backend / resume-backend protocol methods
- modern-backend: exit/enter alt screen, re-enable mouse/kitty/bracketed-paste
- simple-backend: no-ops (no terminal state to preserve)
Infrastructure:
- Update test suite to cover suspend/resume (backend + modern-backend suites)
- 454 checks, 100% pass across 14 test suites
This commit is contained in:
@@ -8,6 +8,16 @@
|
||||
(defgeneric shutdown-backend (backend)
|
||||
(:method ((b backend)) (values)))
|
||||
|
||||
(defgeneric suspend-backend (backend)
|
||||
(:documentation "Temporarily suspend the backend, restoring terminal to normal state.
|
||||
Called before SIGTSTP or similar suspension. Application should redraw after resume.")
|
||||
(:method ((b backend)) (values)))
|
||||
|
||||
(defgeneric resume-backend (backend)
|
||||
(:documentation "Re-initialize the backend after suspension.
|
||||
Called after SIGCONT or similar resume. Re-enables raw mode and backend features.")
|
||||
(:method ((b backend)) (values)))
|
||||
|
||||
(defgeneric backend-size (backend)
|
||||
(:method ((b backend))
|
||||
(values 80 24)))
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
(test osc8-escape
|
||||
"OSC 8 hyperlink escape wraps text"
|
||||
(is (equal (cl-tty.backend::osc8-link "http://example.com" "click here")
|
||||
(format nil "~C]8;;http://example.com~C\click here~C]8;;~C\"
|
||||
(format nil "~C]8;;http://example.com~C\\click here~C]8;;~C\\"
|
||||
#\Esc #\Esc #\Esc #\Esc))))
|
||||
|
||||
(test hex-color-parsing
|
||||
@@ -101,10 +101,16 @@
|
||||
(is (equal (cl-tty.backend::border-char :rounded :top-left) "╭"))
|
||||
(is (equal (cl-tty.backend::border-char :rounded :horizontal) "─"))
|
||||
(is (equal (cl-tty.backend::border-char :rounded :vertical) "│"))
|
||||
(is (equal (cl-tty.backend::border-char :rounded :bottom-right) "╯"))
|
||||
(is (equal (cl-tty.backend::border-char :rounded :bottom-right) "╯")))
|
||||
|
||||
(test border-char-double
|
||||
"modern-border-char returns double-line chars"
|
||||
(is (equal (cl-tty.backend::border-char :double :top-left) "╔"))
|
||||
(is (equal (cl-tty.backend::border-char :double :horizontal) "═"))
|
||||
(is (equal (cl-tty.backend::border-char :double :vertical) "║"))
|
||||
(is (equal (cl-tty.backend::border-char :double :vertical) "║")))
|
||||
|
||||
(test suspend-resume-noop
|
||||
"suspend-backend and resume-backend are no-ops in test context"
|
||||
(let ((b (make-modern-backend)))
|
||||
(is (null (multiple-value-list (suspend-backend b))))
|
||||
(is (null (multiple-value-list (resume-backend b))))))
|
||||
|
||||
@@ -90,7 +90,7 @@ as a fallback when a keyword is not in *named-colors*.")
|
||||
|
||||
(defun osc8-link (url text)
|
||||
"Wrap TEXT in an OSC 8 hyperlink to URL."
|
||||
(format nil \"~C]8;;~A~C\\~A~C]8;;~C\\\"
|
||||
(format nil "~C]8;;~A~C\\~A~C]8;;~C\\"
|
||||
#\Esc url #\Esc text #\Esc #\Esc))
|
||||
|
||||
(defparameter *border-chars*
|
||||
@@ -143,6 +143,24 @@ as a fallback when a keyword is not in *named-colors*.")
|
||||
(finish-output (backend-output-stream b))
|
||||
(values))
|
||||
|
||||
(defmethod suspend-backend ((b modern-backend))
|
||||
(cursor-show b)
|
||||
(backend-write b (format nil "~C[?1049l" #\Esc)) ; normal screen
|
||||
(cursor-move b 0 0)
|
||||
(finish-output (backend-output-stream b))
|
||||
(values))
|
||||
|
||||
(defmethod resume-backend ((b modern-backend))
|
||||
(backend-write b (format nil "~C[?1049h" #\Esc)) ; alt screen
|
||||
(backend-write b (format nil "~C[?1000h" #\Esc)) ; mouse basic
|
||||
(backend-write b (format nil "~C[?1002h" #\Esc)) ; mouse drag
|
||||
(backend-write b (format nil "~C[?1006h" #\Esc)) ; SGR mouse
|
||||
(backend-write b (format nil "~C[?2004h" #\Esc)) ; bracketed paste
|
||||
(backend-write b (format nil "~C[?u" #\Esc)) ; kitty keyboard
|
||||
(cursor-hide b)
|
||||
(finish-output (backend-output-stream b))
|
||||
(values))
|
||||
|
||||
(defmethod backend-size ((b modern-backend))
|
||||
(let* ((+tiocgwinsz+ 21523) ; 0x5413 on Linux
|
||||
(winsize (sb-alien:make-alien sb-alien:unsigned-short 4)))
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#:backend #:simple-backend
|
||||
;; Lifecycle
|
||||
#:initialize-backend #:shutdown-backend
|
||||
#:suspend-backend #:resume-backend
|
||||
#:backend-size #:backend-write #:backend-clear
|
||||
;; Drawing
|
||||
#:draw-text #:draw-border #:draw-rect
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
(defmethod shutdown-backend ((b simple-backend))
|
||||
(values))
|
||||
|
||||
(defmethod suspend-backend ((b simple-backend))
|
||||
(values))
|
||||
|
||||
(defmethod resume-backend ((b simple-backend))
|
||||
(values))
|
||||
|
||||
(defmethod backend-size ((b simple-backend))
|
||||
;; Try ioctl, fall back to 80x24
|
||||
(values 80 24))
|
||||
|
||||
@@ -103,6 +103,8 @@
|
||||
(is (null (multiple-value-list (cursor-style b :block))))
|
||||
(is (null (multiple-value-list (begin-sync b))))
|
||||
(is (null (multiple-value-list (end-sync b))))
|
||||
(is (null (multiple-value-list (suspend-backend b))))
|
||||
(is (null (multiple-value-list (resume-backend b))))
|
||||
(shutdown-backend b)))
|
||||
|
||||
(test sync-is-noop-on-simple
|
||||
|
||||
Reference in New Issue
Block a user