From 6f9ca0ea6648778419ba18c882eefba4615f3f43 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Tue, 16 Jun 2026 15:19:06 +0300 Subject: fix: hold lone escape while awaiting host color reply refs #549 --- src/client/input.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/client/input.rs') diff --git a/src/client/input.rs b/src/client/input.rs index b89a57b1..a17c2404 100644 --- a/src/client/input.rs +++ b/src/client/input.rs @@ -32,20 +32,34 @@ use super::ClientLoopEvent; /// This runs on a dedicated thread because stdin reading is blocking. /// The main loop receives the raw bytes and forwards them as /// `ClientMessage::Input` to the server. -pub fn stdin_reader_loop(event_tx: mpsc::Sender, should_quit: &Arc) { +pub fn stdin_reader_loop( + event_tx: mpsc::Sender, + should_quit: &Arc, + host_color_query_sent: bool, +) { #[cfg(windows)] - return windows_stdin_reader_loop(event_tx, should_quit); + { + let _ = host_color_query_sent; + return windows_stdin_reader_loop(event_tx, should_quit); + } #[cfg(unix)] - unix_stdin_reader_loop(event_tx, should_quit); + unix_stdin_reader_loop(event_tx, should_quit, host_color_query_sent); } #[cfg(unix)] -fn unix_stdin_reader_loop(event_tx: mpsc::Sender, should_quit: &Arc) { +fn unix_stdin_reader_loop( + event_tx: mpsc::Sender, + should_quit: &Arc, + host_color_query_sent: bool, +) { let stdin = io::stdin(); let mut reader = stdin.lock(); let mut scratch = [0u8; 4096]; let mut framer = crate::raw_input::RawInputByteFramer::default(); + if host_color_query_sent { + framer.host_color_query_sent(); + } while !should_quit.load(Ordering::Acquire) { match reader.read(&mut scratch) { -- cgit v1.2.3