fix: set stty -icanon -echo in bash script before exec sbcl
uiop:run-program inside SBCL can't access the terminal, so stty calls from within Lisp fail silently. By running 'stty -icanon -echo' in the bash script before exec sbcl, the terminal is already in character-at-a-time mode when the TUI starts, and Ctrl+P/B keys arrive as individual bytes through the cat pipe.
This commit is contained in:
@@ -910,12 +910,8 @@ Event handlers + daemon I/O + main loop.
|
|||||||
;; breaks read on fd 0 in this SBCL environment, but -echo alone
|
;; breaks read on fd 0 in this SBCL environment, but -echo alone
|
||||||
;; works. A cat subprocess inherits the terminal and provides
|
;; works. A cat subprocess inherits the terminal and provides
|
||||||
;; bytes through a pipe that SBCL reads reliably.
|
;; bytes through a pipe that SBCL reads reliably.
|
||||||
;; Enable character-at-a-time input (-icanon) so Ctrl+P/B
|
;; stty -icanon -echo is set by the bash script before exec sbcl.
|
||||||
;; arrive as individual bytes instead of being buffered.
|
;; A cat subprocess reads keyboard input from the terminal.
|
||||||
;; SBCL now reads from cat's pipe, not directly from fd 0,
|
|
||||||
;; so -icanon doesn't trigger the SBCL read block issue.
|
|
||||||
(uiop:run-program '("stty" "-icanon" "-echo")
|
|
||||||
:output nil :ignore-error-status t)
|
|
||||||
(let* ((cat-proc (uiop:launch-program '("cat")
|
(let* ((cat-proc (uiop:launch-program '("cat")
|
||||||
:output :stream
|
:output :stream
|
||||||
:input :interactive
|
:input :interactive
|
||||||
|
|||||||
@@ -410,6 +410,9 @@ LISPEOF
|
|||||||
# (SBCL strips COLUMNS/LINES but leaves MY_* alone).
|
# (SBCL strips COLUMNS/LINES but leaves MY_* alone).
|
||||||
ts=$(stty size 2>/dev/null)
|
ts=$(stty size 2>/dev/null)
|
||||||
export MY_TERM_ROWS="${ts%% *}" MY_TERM_COLS="${ts##* }"
|
export MY_TERM_ROWS="${ts%% *}" MY_TERM_COLS="${ts##* }"
|
||||||
|
# Set character-at-a-time mode BEFORE SBCL starts
|
||||||
|
# (uiop:run-program inside SBCL can't access the terminal)
|
||||||
|
stty -icanon -echo 2>/dev/null
|
||||||
# Clear stale cl-tty cache to ensure latest backend-size fixes
|
# Clear stale cl-tty cache to ensure latest backend-size fixes
|
||||||
find ~/.cache/common-lisp -name "*.fasl" -path "*cl-tty*" -delete 2>/dev/null
|
find ~/.cache/common-lisp -name "*.fasl" -path "*cl-tty*" -delete 2>/dev/null
|
||||||
exec sbcl --noinform --load /tmp/tui-load.lisp
|
exec sbcl --noinform --load /tmp/tui-load.lisp
|
||||||
|
|||||||
Reference in New Issue
Block a user