diff options
| author | David Heinemeier Hansson <david@hey.com> | 2026-09-26 19:17:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-26 20:17:55 +0300 |
| commit | bd69871d51d683e27c2e7db905704a5964fd94eb (patch) | |
| tree | b2eecde833e789cecd6e8aad5643eaec68d3b3fb /src/client/input.rs | |
| parent | c34dd6b2acd432cb7acbe9de568b245853e3b8c7 (diff) | |
fix: refresh host palette on terminal redraw (#4349)
* fix: refresh host palette on terminal redraw
* fix: count overlapping host palette queries
---------
Co-authored-by: Ogulcan Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/client/input.rs')
| -rw-r--r-- | src/client/input.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client/input.rs b/src/client/input.rs index 23067576..1e308d54 100644 --- a/src/client/input.rs +++ b/src/client/input.rs @@ -10,7 +10,7 @@ //! - We avoid duplicating parsing logic in the client //! - Host terminal control replies can be buffered or discarded before they leak -use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::atomic::{AtomicBool, AtomicU32, Ordering}; use std::sync::Arc; #[cfg(unix)] @@ -39,6 +39,7 @@ pub fn stdin_reader_loop( event_tx: mpsc::Sender<ClientLoopEvent>, should_quit: &Arc<AtomicBool>, host_color_query_sent: bool, + host_theme_query_pending: Arc<AtomicU32>, host_cell_size_query_sent: bool, host_mouse_capture_active: Arc<AtomicBool>, host_sgr_pixels_active: Arc<AtomicBool>, @@ -51,6 +52,7 @@ pub fn stdin_reader_loop( { let _ = ( host_color_query_sent, + host_theme_query_pending, host_cell_size_query_sent, host_mouse_capture_active, host_sgr_pixels_active, @@ -64,6 +66,7 @@ pub fn stdin_reader_loop( event_tx, should_quit, host_color_query_sent, + host_theme_query_pending, host_cell_size_query_sent, host_mouse_capture_active, host_sgr_pixels_active, @@ -79,6 +82,7 @@ fn unix_stdin_reader_loop( event_tx: mpsc::Sender<ClientLoopEvent>, should_quit: &Arc<AtomicBool>, host_color_query_sent: bool, + host_theme_query_pending: Arc<AtomicU32>, host_cell_size_query_sent: bool, host_mouse_capture_active: Arc<AtomicBool>, host_sgr_pixels_active: Arc<AtomicBool>, @@ -178,6 +182,11 @@ fn unix_stdin_reader_loop( match reader.read(&mut scratch) { Ok(0) => break, Ok(n) => { + // A redraw can issue queries while this thread is blocked in read(). + // Arm the split-reply guard before framing the returned bytes. + for _ in 0..host_theme_query_pending.swap(0, Ordering::AcqRel) { + framer.host_color_query_sent(); + } let sgr_pixels = *pending_mode .get_or_insert_with(|| host_sgr_pixels_active.load(Ordering::Acquire)); if sgr_pixels { |
