aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2021-08-24 10:24:10 +0200
committerGitHub <noreply@github.com>2021-08-24 10:24:10 +0200
commitc8d10ee64df6299ce3441c3f3d4bcc5806be30dc (patch)
treeb7ff98494d116d913bb8dec7c164a2b57f3f3274 /zellij-server/src
parentdocs(changelog): add `ToggleTab` action (diff)
downloadsl0ppij-c8d10ee64df6299ce3441c3f3d4bcc5806be30dc.tar.gz
sl0ppij-c8d10ee64df6299ce3441c3f3d4bcc5806be30dc.tar.xz
sl0ppij-c8d10ee64df6299ce3441c3f3d4bcc5806be30dc.zip
fix(compatibility): only send bracketed paste to terminals requesting it (#658)
* fix(compatibility): only send bracketed paste to terminals requesting it * docs(changelog): update change * style(fmt): make rustfmt happy
Diffstat (limited to 'zellij-server/src')
-rw-r--r--zellij-server/src/panes/grid.rs10
-rw-r--r--zellij-server/src/panes/terminal_pane.rs9
2 files changed, 18 insertions, 1 deletions
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs
index 07808b03..a4066ebf 100644
--- a/zellij-server/src/panes/grid.rs
+++ b/zellij-server/src/panes/grid.rs
@@ -351,7 +351,8 @@ pub struct Grid {
pub changed_colors: Option<[Option<AnsiCode>; 256]>,
pub should_render: bool,
pub cursor_key_mode: bool, // DECCKM - when set, cursor keys should send ANSI direction codes (eg. "OD") instead of the arrow keys (eg. "")
- pub erasure_mode: bool, // ERM
+ pub bracketed_paste_mode: bool, // when set, paste instructions to the terminal should be escaped with a special sequence
+ pub erasure_mode: bool, // ERM
pub insert_mode: bool,
pub disable_linewrap: bool,
pub clear_viewport_before_rendering: bool,
@@ -390,6 +391,7 @@ impl Grid {
height: rows,
should_render: true,
cursor_key_mode: false,
+ bracketed_paste_mode: false,
erasure_mode: false,
insert_mode: false,
disable_linewrap: false,
@@ -1630,6 +1632,9 @@ impl Perform for Grid {
};
if first_intermediate_is_questionmark {
match params_iter.next().map(|param| param[0]) {
+ Some(2004) => {
+ self.bracketed_paste_mode = false;
+ }
Some(1049) => {
if let Some((
alternative_lines_above,
@@ -1683,6 +1688,9 @@ impl Perform for Grid {
self.show_cursor();
self.mark_for_rerender();
}
+ Some(2004) => {
+ self.bracketed_paste_mode = true;
+ }
Some(1049) => {
let current_lines_above = std::mem::replace(
&mut self.lines_above,
diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs
index 7adb9c78..55bd9185 100644
--- a/zellij-server/src/panes/terminal_pane.rs
+++ b/zellij-server/src/panes/terminal_pane.rs
@@ -144,6 +144,15 @@ impl Pane for TerminalPane {
return "OB".as_bytes().to_vec();
}
}
+ [27, 91, 50, 48, 48, 126] | [27, 91, 50, 48, 49, 126] => {
+ if !self.grid.bracketed_paste_mode {
+ // Zellij itself operates in bracketed paste mode, so the terminal sends these
+ // instructions (bracketed paste start and bracketed paste end respectively)
+ // when pasting input. We only need to make sure not to send them to terminal
+ // panes who do not work in this mode
+ return vec![];
+ }
+ }
_ => {}
};
input_bytes