diff options
author | Aram Drevekenin <aram@poor.dev> | 2022-07-14 11:55:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 11:55:07 +0200 |
commit | cbbdccc285d78974b55079112c1cfbc52215bea5 (patch) | |
tree | e4c8c3a7b725cdd1b17764f326288101f2978998 /zellij-server/src/panes/grid.rs | |
parent | e4b1dd6d4ca5db7ba8d43b73054a1208cdc73293 (diff) |
fix(terminal): persist cursor hide/show through alternate screen (#1586)
* fix(terminal): persist cursor hide/show through alternate screen
* style(fmt): rustfmt
* style(clippy): make clippy happy
Diffstat (limited to 'zellij-server/src/panes/grid.rs')
-rw-r--r-- | zellij-server/src/panes/grid.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index 8c6e3e090..aef67f981 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -305,6 +305,7 @@ pub struct Grid { horizontal_tabstops: BTreeSet<usize>, alternate_screen_state: Option<AlternateScreenState>, cursor: Cursor, + cursor_is_hidden: bool, saved_cursor_position: Option<Cursor>, // FIXME: change scroll_region to be (usize, usize) - where the top line is always the first // line of the viewport and the bottom line the last unless it's changed with CSI r and friends @@ -408,6 +409,7 @@ impl Grid { lines_below: vec![], horizontal_tabstops: create_horizontal_tabstops(columns), cursor: Cursor::new(0, 0), + cursor_is_hidden: false, saved_cursor_position: None, scroll_region: None, preceding_char: None, @@ -898,7 +900,7 @@ impl Grid { (changed_character_chunks, changed_sixel_image_chunks) } pub fn cursor_coordinates(&self) -> Option<(usize, usize)> { - if self.cursor.is_hidden { + if self.cursor_is_hidden { None } else { Some((self.cursor.x, self.cursor.y)) @@ -1309,10 +1311,10 @@ impl Grid { } } pub fn hide_cursor(&mut self) { - self.cursor.is_hidden = true; + self.cursor_is_hidden = true; } pub fn show_cursor(&mut self) { - self.cursor.is_hidden = false; + self.cursor_is_hidden = false; } pub fn set_scroll_region(&mut self, top_line_index: usize, bottom_line_index: Option<usize>) { let bottom_line_index = bottom_line_index.unwrap_or(self.height); |