docs: sync .org with implementation for backend-size, read-raw-byte, SIGWINCH

backend-protocol.org / simple.lisp:
- Replace hard-coded 80x24 prose with full 5-step fallback chain
  (MY_TERM env vars → ioctl fd 0 → ioctl stdout → /dev/tty → 80x24)
- Document return-from pattern (or discards secondary values)

modern-backend.org / modern.lisp:
- Replace simple ioctl-only prose with 4-step fallback chain
- Document env-var pre-check and /dev/tty fallback

text-input.org / input.lisp:
- Update read-raw-byte prose: with-pinned-objects/vector-sap
  instead of alien buffer (code was already correct, prose stale)
- Add missing (require :sb-posix) to SIGWINCH handler code block
- Document :sb-posix requirement in prose
This commit is contained in:
2026-05-14 16:25:45 -04:00
parent b44b4b6aa0
commit 916f473107
6 changed files with 138 additions and 47 deletions

View File

@@ -162,9 +162,9 @@ as a fallback when a keyword is not in *named-colors*.")
(values))
(defmethod backend-size ((b modern-backend))
;; MY_TERM_COLS/MY_TERM_ROWS — set by the passepartout script
;; before exec sbcl. Check FIRST with return-from so both
;; values (cols and rows) are preserved (or discards secondaries).
;; MY_TERM_COLS/MY_TERM_ROWS — set by the calling script.
;; Check FIRST with return-from so both values (cols and rows)
;; are preserved (or discards secondaries).
(let ((cstr (sb-ext:posix-getenv "MY_TERM_COLS"))
(rstr (sb-ext:posix-getenv "MY_TERM_ROWS")))
(when (and cstr rstr)
@@ -184,8 +184,8 @@ as a fallback when a keyword is not in *named-colors*.")
(values (sb-alien:deref winsize 1) ;; cols
(sb-alien:deref winsize 0)))) ;; rows
(sb-alien:free-alien winsize))))
(when (and cols rows (> cols 0) (> rows 0))
(values cols rows)))
(when (and cols rows (> cols 0) (> rows 0))
(values cols rows)))
;; Direct ioctl on /dev/tty.
(ignore-errors
(let ((tty-fd (sb-unix:unix-open "/dev/tty" 0 0)))
@@ -198,7 +198,7 @@ as a fallback when a keyword is not in *named-colors*.")
(let ((cols (sb-alien:deref winsize 1))
(rows (sb-alien:deref winsize 0)))
(values cols rows)))))
(sb-unix:unix-close tty-fd)))))
(sb-unix:unix-close tty-fd)))))
(values 80 24)))
(defmethod backend-write ((b modern-backend) string)