summaryrefslogtreecommitdiff
path: root/src/client/mod.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-02 17:36:00 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-02 17:36:00 +0300
commit10ba9f023cc48beb406858b9b703347429ebccd1 (patch)
treec18f719d2e071207dee4de4f2ed5d8bb60ee1fc0 /src/client/mod.rs
parent45005f1f733a96e3d9e6748577c01ca2c594304b (diff)
fix: stabilize hidden cursor position during client redraw
Wrap client frame blits in synchronized output and park hidden cursors at the last visible pane cursor, falling back to bottom-right when no cursor has been seen. This prevents IME and mobile SSH clients from anchoring composition to incidental repaint positions such as sidebar animations.
Diffstat (limited to 'src/client/mod.rs')
-rw-r--r--src/client/mod.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs
index f95d0fd4..5b6c1bf1 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -42,6 +42,9 @@ use crate::server::protocol::{
struct ClientState {
/// The last frame we rendered, used for diff-based blitting.
last_frame: Option<FrameData>,
+ /// Last visible cursor exported by the focused pane, used as the hidden
+ /// cursor parking position when the pane temporarily hides its cursor.
+ last_visible_cursor: Option<(u16, u16)>,
/// The terminal size we reported to the server in our last Hello/Resize.
reported_size: (u16, u16),
/// Client-local sound playback config, refreshed on server request.
@@ -359,6 +362,7 @@ async fn run_client_loop(
) -> Result<(), ClientError> {
let mut state = ClientState {
last_frame: None,
+ last_visible_cursor: None,
reported_size: (cols, rows),
sound_config,
};
@@ -424,7 +428,11 @@ async fn run_client_loop(
}
ClientLoopEvent::ServerMessage(msg) => match msg {
ServerMessage::Frame(frame_data) => {
- blit::blit_frame(&frame_data, state.last_frame.as_ref());
+ blit::blit_frame_with_cursor_memory(
+ &frame_data,
+ state.last_frame.as_ref(),
+ &mut state.last_visible_cursor,
+ );
state.last_frame = Some(frame_data);
let _ = io::stdout().flush();
}