From b2f5f1cf1a644993c0594880b8b44145e2b8aa31 Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Thu, 14 May 2026 15:12:21 -0400 Subject: [PATCH] fix: add stty -icanon for character-at-a-time input Without -icanon, the terminal driver buffers all input until Enter, so Ctrl+P/B never arrive as individual key events. With -icanon, cat reads bytes immediately and pipes them to SBCL. SBCL reads from the pipe, not fd 0, so there's no fd 0 read block issue. --- org/channel-tui-main.org | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/org/channel-tui-main.org b/org/channel-tui-main.org index 78283a0..56f30b9 100644 --- a/org/channel-tui-main.org +++ b/org/channel-tui-main.org @@ -910,8 +910,13 @@ Event handlers + daemon I/O + main loop. ;; breaks read on fd 0 in this SBCL environment, but -echo alone ;; works. A cat subprocess inherits the terminal and provides ;; bytes through a pipe that SBCL reads reliably. - ;; A cat subprocess reads keyboard input from the terminal. - (let* ((cat-proc (uiop:launch-program '("stdbuf" "-o0" "cat") + ;; Enable character-at-a-time input (-icanon) so Ctrl+P/B + ;; arrive as individual bytes instead of being buffered. + ;; 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") :output :stream :input :interactive :stderr nil))