v0.8.0: tangle to XDG (~/.local/share/cl-tty/), remove stale memex .lisp files
This commit is contained in:
@@ -80,7 +80,7 @@ Using a global variable rather than a closure or class slot keeps the detection
|
||||
path stateless and trivially resettable for testing: binding ~*detected-backend*~
|
||||
to ~nil~ forces a fresh detection run.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/backend/detection.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/backend/detection.lisp
|
||||
(in-package :cl-tty.backend)
|
||||
|
||||
(defvar *detected-backend* nil
|
||||
@@ -98,7 +98,7 @@ sequence queries.
|
||||
Case-insensitive matching via ~char-equal~ handles variances across platforms
|
||||
(GNOME Terminal uses ~truecolor~, some Windows builds use ~24bit~).
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/backend/detection.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/backend/detection.lisp
|
||||
(defun detect-backend-by-env ()
|
||||
"Check COLORTERM environment variable for modern terminal support.
|
||||
Returns :modern if COLORTERM contains 'truecolor' or '24bit', nil otherwise."
|
||||
@@ -119,7 +119,7 @@ further (I/O-dependent) probes. Must happen before ~detect-backend-by-da1~.
|
||||
Testing this predicate first also avoids wasting time on DA1 queries when the
|
||||
output is consumed by a test runner, CI pipeline, or pipe.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/backend/detection.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/backend/detection.lisp
|
||||
(defun detect-backend-by-tty ()
|
||||
"Check if stdout is a real terminal (not a pipe/redirect).
|
||||
Returns T if stdout is interactive, nil otherwise."
|
||||
@@ -140,7 +140,7 @@ bytes arrive within the timeout without blocking. The ~0.1~ second default
|
||||
strikes a balance between responsiveness and reliability: fast enough to avoid
|
||||
noticeable delay in interactive use, long enough for most terminals to reply.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/backend/detection.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/backend/detection.lisp
|
||||
(defun query-terminal (query &optional (timeout 0.1))
|
||||
"Send QUERY string to terminal and return any response received within
|
||||
TIMEOUT seconds. Returns the response string, or nil if no response."
|
||||
@@ -168,7 +168,7 @@ This probe is best-effort: many terminals do not respond within the timeout,
|
||||
and some return different codes for the same capabilities. A ~nil~ result from
|
||||
this function should never prevent fallback detection via environment variables.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/backend/detection.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/backend/detection.lisp
|
||||
(defun detect-backend-by-da1 ()
|
||||
"Send DA1 (ESC[c) query and check for kitty terminal response code.
|
||||
Returns T if terminal reports kitty compatibility codes."
|
||||
@@ -193,7 +193,7 @@ returns nil, the expensive DA1 query never runs. If ~detect-backend-by-env~
|
||||
returns ~:modern~, the DA1 query is skipped. The result is cached in
|
||||
~*detected-backend*~ so subsequent calls are effectively free.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/backend/detection.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/backend/detection.lisp
|
||||
(defun detect-backend ()
|
||||
"Auto-detect the appropriate backend for the current terminal.
|
||||
Returns a backend instance (modern-backend or simple-backend).
|
||||
|
||||
Reference in New Issue
Block a user