summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-12-02 17:04:12 +0100
committerGitHub <noreply@github.com>2023-12-02 17:04:12 +0100
commitecd5e3c4537ba2cff6d61ce2513cd20f90d103f2 (patch)
tree882ccee62cef96507f574d716629d7e1a505425f
parentd8bbe9115e7944e2bca64494784c26bd1552b493 (diff)
feat(terminal): implement synchronized renders (#2977)
-rw-r--r--zellij-server/src/panes/grid.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs
index 0613c7e31..b7ed874f7 100644
--- a/zellij-server/src/panes/grid.rs
+++ b/zellij-server/src/panes/grid.rs
@@ -348,6 +348,7 @@ pub struct Grid {
sixel_grid: SixelGrid,
pub changed_colors: Option<[Option<AnsiCode>; 256]>,
pub should_render: bool,
+ pub lock_renders: 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 bracketed_paste_mode: bool, // when set, paste instructions to the terminal should be escaped with a special sequence
pub erasure_mode: bool, // ERM
@@ -520,6 +521,7 @@ impl Grid {
debug,
arrow_fonts,
styled_underlines,
+ lock_renders: false,
}
}
pub fn render_full_viewport(&mut self) {
@@ -1074,6 +1076,9 @@ impl Grid {
content_y: usize,
style: &Style,
) -> Result<Option<(Vec<CharacterChunk>, Option<String>, Vec<SixelImageChunk>)>> {
+ if self.lock_renders {
+ return Ok(None);
+ }
let mut raw_vte_output = String::new();
let (mut character_chunks, sixel_image_chunks) = self.read_changes(content_x, content_y);
@@ -2144,6 +2149,12 @@ impl Grid {
pub fn reset_cursor_position(&mut self) {
self.cursor = Cursor::new(0, 0, self.styled_underlines);
}
+ pub fn lock_renders(&mut self) {
+ self.lock_renders = true;
+ }
+ pub fn unlock_renders(&mut self) {
+ self.lock_renders = false;
+ }
}
impl Perform for Grid {
@@ -2520,6 +2531,9 @@ impl Perform for Grid {
if first_intermediate_is_questionmark {
for param in params_iter.map(|param| param[0]) {
match param {
+ 2026 => {
+ self.unlock_renders();
+ },
2004 => {
self.bracketed_paste_mode = false;
},
@@ -2615,6 +2629,9 @@ impl Perform for Grid {
self.show_cursor();
self.mark_for_rerender();
},
+ 2026 => {
+ self.lock_renders();
+ },
2004 => {
self.bracketed_paste_mode = true;
},
@@ -2697,6 +2714,24 @@ impl Perform for Grid {
}
}
}
+ } else if c == 'p' {
+ let first_intermediate_is_questionmark = match intermediates.get(0) {
+ Some(b'?') => true,
+ None => false,
+ _ => false,
+ };
+ if first_intermediate_is_questionmark {
+ for param in params_iter.map(|param| param[0]) {
+ match param {
+ 2026 => {
+ let response = "\u{1b}[2026;2$y";
+ self.pending_messages_to_pty
+ .push(response.as_bytes().to_vec());
+ },
+ _ => {},
+ }
+ }
+ }
} else if c == 'r' {
if params.len() > 1 {
let top = (next_param_or(1) as usize).saturating_sub(1);