diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-16 15:19:06 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-16 15:19:06 +0300 |
| commit | 6f9ca0ea6648778419ba18c882eefba4615f3f43 (patch) | |
| tree | 3bf6a923e34234ac4a92df67e9630c651579ea74 /src/client | |
| parent | 2fe57a57a2b335c6d300a96b442d428b9b2cadf8 (diff) | |
fix: hold lone escape while awaiting host color reply
refs #549
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/input.rs | 22 | ||||
| -rw-r--r-- | src/client/mod.rs | 6 |
2 files changed, 22 insertions, 6 deletions
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<ClientLoopEvent>, should_quit: &Arc<AtomicBool>) { +pub fn stdin_reader_loop( + event_tx: mpsc::Sender<ClientLoopEvent>, + should_quit: &Arc<AtomicBool>, + 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<ClientLoopEvent>, should_quit: &Arc<AtomicBool>) { +fn unix_stdin_reader_loop( + event_tx: mpsc::Sender<ClientLoopEvent>, + should_quit: &Arc<AtomicBool>, + 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) { diff --git a/src/client/mod.rs b/src/client/mod.rs index b7fd212d..2fc899ce 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -778,13 +778,15 @@ async fn run_client_loop( let (event_tx, mut event_rx) = tokio::sync::mpsc::channel::<ClientLoopEvent>(256); // Spawn the stdin reader thread. + let will_query_host_terminal_theme = + state.attach_escape.is_none() && should_query_host_terminal_theme(); let stdin_quit = should_quit.clone(); let stdin_tx = event_tx.clone(); std::thread::spawn(move || { - input::stdin_reader_loop(stdin_tx, &stdin_quit); + input::stdin_reader_loop(stdin_tx, &stdin_quit, will_query_host_terminal_theme); }); - if state.attach_escape.is_none() && should_query_host_terminal_theme() { + if will_query_host_terminal_theme { query_host_terminal_theme(); } |
