fix: org tangle — fix END_SRC boundaries in mouse.org/slot.org (prose inside code blocks), replace emacs tangle with Python script that handles all blocks
This commit is contained in:
@@ -108,19 +108,30 @@ Returns T if stdout is interactive, nil otherwise."
|
||||
Send a DA1 (Device Attributes) query and briefly listen for a response.
|
||||
This is best-effort — many terminals respond asynchronously or not at all.
|
||||
|
||||
*** Bug Fixes (v1.0.0): query-terminal stream fix
|
||||
|
||||
~query-terminal~ originally used ~*query-io*~ for both writing the query and
|
||||
reading the response. In raw terminal mode, the terminal's response arrives on
|
||||
stdin, not on the query I/O stream. This caused ~query-terminal~ to never
|
||||
receive a response on certain terminal emulators.
|
||||
|
||||
Fix: Write queries to ~*standard-output*~ and read responses from
|
||||
~*standard-input*~. This matches where the terminal actually delivers its
|
||||
DA1/DA3 response bytes.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../backend/detection.lisp
|
||||
;;; ─── DA1 terminal query ─────────────────────────────────────────────────────
|
||||
|
||||
(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."
|
||||
(write-string query *query-io*)
|
||||
(force-output *query-io*)
|
||||
(write-string query *standard-output*)
|
||||
(force-output *standard-output*)
|
||||
(sleep timeout)
|
||||
(let ((response (make-array 0 :element-type 'character
|
||||
:fill-pointer 0 :adjustable t)))
|
||||
(loop while (listen *query-io*)
|
||||
do (vector-push-extend (read-char-no-hang *query-io*) response))
|
||||
(loop while (listen *standard-input*)
|
||||
do (vector-push-extend (read-char-no-hang *standard-input*) response))
|
||||
(when (plusp (length response))
|
||||
response)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user