aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--CHANGELOG.md2
-rw-r--r--zellij-server/src/panes/grid.rs10
-rw-r--r--zellij-server/src/panes/terminal_pane.rs9
3 files changed, 20 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 559d9968..a6989222 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,9 +21,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* Fix various shells (eg. nushell) unexpectedly exiting when the user presses ctrl-c (https://github.com/zellij-org/zellij/pull/648)
* Fix line wrapping while scrolling (https://github.com/zellij-org/zellij/pull/650)
* Indicate to the user when text is copied to the clipboard with the mouse (https://github.com/zellij-org/zellij/pull/642)
+* Terminal compatibility: properly paste multilines (https://github.com/zellij-org/zellij/pull/653 + https://github.com/zellij-org/zellij/pull/658)
* Terminal compatibility: fix progress bar line overflow (http://github.com/zellij-org/zellij/pull/656)
* Add action to toggle between tabs `ToggleTab`, bound by default to [TAB] in tab mode (https://github.com/zellij-org/zellij/pull/622)
+
## [0.15.0] - 2021-07-19
* Kill children properly (https://github.com/zellij-org/zellij/pull/601)
* Change name of `Run` binding for actions (https://github.com/zellij-org/zellij/pull/602)
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