diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-12 03:36:41 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-12 03:37:03 +0300 |
| commit | 7ba4bfe90e7a17b11979e729d29d82723bb3b0bf (patch) | |
| tree | a76257e9e3273e79c9de61711186e2287d778e3a /src/client | |
| parent | 6e7ce87bab6a5d4f277613658d0f19afb114128b (diff) | |
fix: stabilize windows pane cursor rendering
refs #556
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/mod.rs | 58 |
1 files changed, 1 insertions, 57 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs index 1e46f190..e4daf82d 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -19,8 +19,6 @@ use std::io::{self, Write as _}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex, OnceLock}; use std::time::Duration; -#[cfg(windows)] -use std::time::Instant; use crossterm::event::{ DisableBracketedPaste, DisableFocusChange, DisableMouseCapture, EnableBracketedPaste, @@ -70,21 +68,12 @@ struct ClientState { mouse_scroll_lines: usize, /// Whether outer focus gain should force a full host-terminal redraw. redraw_on_focus_gained: bool, - #[cfg(windows)] - pending_cursor_reveal: Option<PendingCursorReveal>, } #[derive(Debug, Default)] #[cfg(windows)] struct AttachEscapeState; -#[derive(Debug)] -#[cfg(windows)] -struct PendingCursorReveal { - due_at: Instant, - bytes: Vec<u8>, -} - #[derive(Debug, Default)] #[cfg(unix)] struct AttachEscapeState { @@ -212,37 +201,6 @@ fn attach_scroll_action( impl ClientState { fn request_full_redraw(&mut self) { self.blit_encoder = render_ansi::BlitEncoder::new(); - #[cfg(windows)] - { - self.pending_cursor_reveal = None; - } - } - - #[cfg(windows)] - fn update_pending_cursor_reveal(&mut self, reveal: Option<Vec<u8>>) { - const CURSOR_REVEAL_DEBOUNCE: Duration = Duration::from_millis(90); - self.pending_cursor_reveal = reveal.map(|bytes| PendingCursorReveal { - due_at: Instant::now() + CURSOR_REVEAL_DEBOUNCE, - bytes, - }); - } - - #[cfg(windows)] - fn flush_pending_cursor_reveal_if_due(&mut self) { - let Some(pending) = &self.pending_cursor_reveal else { - return; - }; - if pending.due_at > Instant::now() { - return; - } - - let pending = self - .pending_cursor_reveal - .take() - .expect("pending cursor reveal"); - let mut stdout = io::stdout(); - let _ = stdout.write_all(&pending.bytes); - let _ = stdout.flush(); } } @@ -813,8 +771,6 @@ async fn run_client_loop( #[cfg(unix)] mouse_scroll_lines, redraw_on_focus_gained, - #[cfg(windows)] - pending_cursor_reveal: None, }; debug!(?negotiated_encoding, "client render encoding active"); @@ -986,14 +942,7 @@ async fn run_client_loop( } ClientLoopEvent::ServerMessage(msg) => match msg { ServerMessage::Frame(frame_data) => { - #[cfg(windows)] - let encoded = state - .blit_encoder - .encode_with_deferred_cursor_reveal(&frame_data, false); - #[cfg(not(windows))] let encoded = state.blit_encoder.encode(&frame_data, false); - #[cfg(windows)] - let deferred_cursor_reveal = encoded.deferred_cursor_reveal.clone(); let mut stdout = io::stdout(); let graphics = if state.kitty_graphics_enabled { frame_data.graphics.as_slice() @@ -1004,8 +953,6 @@ async fn run_client_loop( write_encoded_frame_with_graphics(&mut stdout, &encoded.bytes, graphics); let _ = stdout.flush(); state.blit_encoder.commit(frame_data, encoded); - #[cfg(windows)] - state.update_pending_cursor_reveal(deferred_cursor_reveal); } ServerMessage::Terminal(frame) => { if state.kitty_graphics_enabled && contains_kitty_graphics_bytes(&frame.bytes) { @@ -1060,10 +1007,7 @@ async fn run_client_loop( "server closed connection", ))); } - ClientLoopEvent::Timer => { - #[cfg(windows)] - state.flush_pending_cursor_reveal_if_due(); - } + ClientLoopEvent::Timer => {} } } |
