aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-client
diff options
context:
space:
mode:
authorThomas Linford <tlinford@users.noreply.github.com>2021-12-28 21:39:20 +0100
committerGitHub <noreply@github.com>2021-12-28 21:39:20 +0100
commit6e35f29b0fabd30ef523d4964153a3f89e53f6f3 (patch)
treec38a14f2d12e49807269aefc2b43b7509f732dc3 /zellij-client
parentUpdate CHANGELOG.md (diff)
downloadsl0ppij-6e35f29b0fabd30ef523d4964153a3f89e53f6f3.tar.gz
sl0ppij-6e35f29b0fabd30ef523d4964153a3f89e53f6f3.tar.xz
sl0ppij-6e35f29b0fabd30ef523d4964153a3f89e53f6f3.zip
fix(mouse): prevent unhandled mouse events escape to terminal (#976)
* workaround to not write csi mouse seqs to terminal * tab: copy selection to clipboard only if selecting was initiated with left click * cleanup debug log messages * unset selecting_with_mouse when selection is empty
Diffstat (limited to 'zellij-client')
-rw-r--r--zellij-client/src/stdin_handler.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/zellij-client/src/stdin_handler.rs b/zellij-client/src/stdin_handler.rs
index 7d93ac4d..67149b4d 100644
--- a/zellij-client/src/stdin_handler.rs
+++ b/zellij-client/src/stdin_handler.rs
@@ -58,6 +58,7 @@ pub(crate) fn stdin_loop(
) {
let mut pasting = false;
let bracketed_paste_start = vec![27, 91, 50, 48, 48, 126]; // \u{1b}[200~
+ let csi_mouse_sgr_start = vec![27, 91, 60];
let adjusted_keys = keys_to_adjust();
loop {
let mut stdin_buffer = os_input.read_from_stdin();
@@ -149,6 +150,19 @@ pub(crate) fn stdin_loop(
continue;
}
}
+
+ // FIXME: termion does not properly parse some csi sgr mouse sequences
+ // like ctrl + click.
+ // As a workaround, to avoid writing these sequences to tty stdin,
+ // we discard them.
+ if let termion::event::Event::Unsupported(_) = key_event {
+ if raw_bytes.len() > csi_mouse_sgr_start.len()
+ && raw_bytes[0..csi_mouse_sgr_start.len()] == csi_mouse_sgr_start
+ {
+ continue;
+ }
+ }
+
send_input_instructions
.send(InputInstruction::KeyEvent(key_event, raw_bytes))
.unwrap();