diff options
| author | akbash <akbash@herdr.dev> | 2026-09-20 17:10:16 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-20 16:10:16 +0200 |
| commit | c00a62dda169beb472fc2f386d0f673ca100dfa4 (patch) | |
| tree | ff0822ed7bb848e2e340dc382920da7c519f2458 /src/client/mod.rs | |
| parent | 29f9f4056f344af60f411004fc89c7eb5f357c48 (diff) | |
fix: preserve delayed mouse reports with confirmed keyboard input (#4247)
* fix: preserve delayed mouse reports with confirmed keyboard input
refs #3480
* fix: capture geometry before replaying buffered mouse input
refs #3480
---------
Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com>
Co-authored-by: JJ Liebig <jonathan.liebig@gmail.com>
Diffstat (limited to 'src/client/mod.rs')
| -rw-r--r-- | src/client/mod.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs index 1cef87a7..a5094397 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -79,6 +79,7 @@ fn refresh_host_mouse_capture(enabled: bool, sgr_pixels: bool) { warn!(err = %err, "failed to re-assert host mouse capture"); } } + #[cfg(windows)] use terminal_setup::{is_ssh_session, windows_vti_input_backend_enabled}; #[cfg(test)] @@ -179,7 +180,7 @@ fn run_client_with_mode( let endpoint_keybindings = shell_config .as_ref() .is_some_and(shell::ClientShellConfig::uses_endpoint_keybindings); - let loop_config = ClientLoopConfig { + let mut loop_config = ClientLoopConfig { sound_config: loaded_config.config.ui.sound, mouse_scroll_lines, redraw_on_focus_gained, @@ -188,6 +189,8 @@ fn run_client_with_mode( pixel_geometry_enabled, pixel_geometry_fallback: kitty_graphics_enabled, mouse_capture_active: mouse_capture, + host_escape_disambiguation_active: false, + initial_host_input: Vec::new(), endpoint_keybindings, remote_image_paste_key, shell_config, @@ -278,7 +281,7 @@ fn run_client_with_mode( // The federated shell can show connection notices without any server snapshot. let direct_attach = attach_escape.is_some(); - let terminal_guard = if direct_attach { + let mut terminal_guard = if direct_attach { setup_direct_attach_terminal(mouse_capture) } else { setup_terminal(mouse_capture) @@ -287,6 +290,9 @@ fn run_client_with_mode( eprintln!("herdr: failed to set up terminal: {err}"); err })?; + loop_config.host_escape_disambiguation_active = + terminal_guard.host_escape_disambiguation_active(); + loop_config.initial_host_input = terminal_guard.take_buffered_host_input(); // Install a panic hook so the foreground client always restores its terminal. let panic_restore = terminal_guard.panic_restore(); @@ -374,7 +380,7 @@ async fn run_client_loop( initial_cell_height_px: u32, initial_pixel_geometry_exact: bool, should_quit: Arc<AtomicBool>, - config: ClientLoopConfig, + mut config: ClientLoopConfig, attach_escape: Option<AttachEscapeState>, _terminal_guard: &TerminalGuard, ) -> Result<(), ClientError> { @@ -475,6 +481,8 @@ async fn run_client_loop( let stdin_quit = should_quit.clone(); let stdin_mouse_capture_active = host_mouse_capture_active.clone(); let stdin_sgr_pixels_active = host_sgr_pixels_active.clone(); + let stdin_escape_disambiguation_active = config.host_escape_disambiguation_active; + let stdin_initial_host_input = std::mem::take(&mut config.initial_host_input); #[cfg(unix)] let stdin_direct_response = state.direct_graphics_response.clone(); #[cfg(unix)] @@ -490,6 +498,8 @@ async fn run_client_loop( will_query_host_cell_size, stdin_mouse_capture_active, stdin_sgr_pixels_active, + stdin_escape_disambiguation_active, + stdin_initial_host_input, #[cfg(unix)] stdin_direct_response, #[cfg(unix)] |
