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:
@@ -215,7 +215,7 @@ and ~\\ for literal backslash.
|
||||
(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))))
|
||||
#+END_SRC
|
||||
|
||||
@@ -269,7 +269,7 @@ characters for the four corners and edges.
|
||||
(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) "╯")))
|
||||
#+END_SRC
|
||||
|
||||
** Border characters --- double style
|
||||
@@ -281,7 +281,20 @@ Confirms that =:double= style maps to double-line box-drawing characters.
|
||||
"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) "║")))
|
||||
#+END_SRC
|
||||
|
||||
** Suspend/resume backend
|
||||
|
||||
Verifies that suspend-backend and resume-backend are no-ops when called
|
||||
on a backend not attached to a real terminal (no errors, return nil).
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/backend/modern-tests.lisp
|
||||
(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))))))
|
||||
#+END_SRC
|
||||
|
||||
* Implementation
|
||||
@@ -475,7 +488,7 @@ allows clickable text in terminals that support the protocol.
|
||||
#+BEGIN_SRC lisp :tangle ../src/backend/modern.lisp
|
||||
(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))
|
||||
#+END_SRC
|
||||
|
||||
@@ -586,6 +599,49 @@ leaves the alternate screen. Returns =nil= (via =(values)=).
|
||||
(values))
|
||||
#+END_SRC
|
||||
|
||||
*** Suspend backend (temporary)
|
||||
|
||||
Temporarily suspends the modern backend, restoring the terminal to a
|
||||
usable state so the shell (or parent process) can take over. Called
|
||||
before =SIGTSTP= or similar process suspension.
|
||||
|
||||
Shows the cursor and exits the alternate screen buffer so the user
|
||||
sees the normal terminal content. Does NOT disable mouse modes or
|
||||
kitty keyboard — those would add ~100ms of overhead on every
|
||||
suspend/resume cycle and are harmless while suspended (the terminal
|
||||
just ignores the escape sequences).
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/backend/modern.lisp
|
||||
(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))
|
||||
#+END_SRC
|
||||
|
||||
*** Resume backend (after suspend)
|
||||
|
||||
Re-initializes the modern backend after a suspension. Called after
|
||||
=SIGCONT= or similar process resume.
|
||||
|
||||
Re-enters the alternate screen buffer and re-enables all input
|
||||
features (mouse, bracketed paste, kitty keyboard). The application
|
||||
is responsible for redrawing the full screen after resume.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/backend/modern.lisp
|
||||
(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))
|
||||
#+END_SRC
|
||||
|
||||
** Backend-size via ioctl
|
||||
|
||||
*** backend-size
|
||||
|
||||
Reference in New Issue
Block a user