diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-03 22:19:47 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-03 22:19:47 +0300 |
| commit | 6f148588dde3b330618981c344c12f400d74da7d (patch) | |
| tree | 49e296f55a781bb3e4f2759311c667f2115b3a61 /src/client | |
| parent | 6ea68f9af2569ea87b7d243c5bbe4f3bc4c8fa44 (diff) | |
fix: scope empty image paste bridge to remote
refs #986
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/mod.rs | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs index ceed9826..6a70c79c 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -1278,6 +1278,8 @@ async fn run_client_loop( #[cfg(windows)] let _ = config.mouse_scroll_lines; let draw_host_cursor = attach_escape.is_none() && should_draw_host_cursor(config.host_cursor); + #[cfg(unix)] + let is_remote_client = is_remote_client_process(); let mut state = ClientState { blit_encoder: render_ansi::BlitEncoder::new(), @@ -1409,7 +1411,11 @@ async fn run_client_loop( } data }; - if should_bridge_clipboard_image_paste(&data, state.remote_image_paste_key) { + if should_bridge_clipboard_image_paste( + &data, + is_remote_client, + state.remote_image_paste_key, + ) { if let Some(image) = crate::platform::read_clipboard_image() { if image.bytes.len() > MAX_CLIPBOARD_IMAGE_PAYLOAD { warn!( @@ -1761,10 +1767,11 @@ fn sound_from_notify_message(message: &str) -> Option<crate::sound::Sound> { #[cfg(unix)] fn should_bridge_clipboard_image_paste( data: &[u8], + is_remote_client: bool, remote_image_paste_key: Option<(crossterm::event::KeyCode, crossterm::event::KeyModifiers)>, ) -> bool { if data == b"\x1b[200~\x1b[201~" { - return true; + return is_remote_client; } let Some(remote_image_paste_key) = remote_image_paste_key else { @@ -2080,21 +2087,37 @@ mod tests { #[test] fn clipboard_image_paste_bridge_triggers_on_configured_key_and_empty_paste() { let ctrl_v = crate::config::parse_key_combo("ctrl+v").unwrap(); - assert!(should_bridge_clipboard_image_paste(&[0x16], Some(ctrl_v))); + assert!(should_bridge_clipboard_image_paste( + &[0x16], + true, + Some(ctrl_v) + )); assert!(should_bridge_clipboard_image_paste( b"\x1b[118;5u", + true, Some(ctrl_v) )); assert!(should_bridge_clipboard_image_paste( b"\x1b[200~\x1b[201~", + true, None )); assert!(!should_bridge_clipboard_image_paste( + b"\x1b[200~\x1b[201~", + false, + Some(ctrl_v) + )); + assert!(!should_bridge_clipboard_image_paste( b"\x1b[200~text\x1b[201~", + true, + Some(ctrl_v) + )); + assert!(!should_bridge_clipboard_image_paste(&[0x16], true, None)); + assert!(!should_bridge_clipboard_image_paste( + b"v", + true, Some(ctrl_v) )); - assert!(!should_bridge_clipboard_image_paste(&[0x16], None)); - assert!(!should_bridge_clipboard_image_paste(b"v", Some(ctrl_v))); } #[test] |
