fix(compatibility): maintain original cursor shape (#659)

* fix(compatibility): maintain original cursor shape

* docs(changelog): document change
This commit is contained in:
Aram Drevekenin 2021-08-25 13:43:18 +02:00 committed by GitHub
parent c8d10ee64d
commit 6f2d7d0176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 4 deletions

View File

@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* 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)
* Terminal compatibility: properly handle cursor shape changes in eg. Neovim (https://github.com/zellij-org/zellij/pull/659)
## [0.15.0] - 2021-07-19

View File

@ -1219,7 +1219,7 @@ impl Grid {
self.active_charset = Default::default();
self.erasure_mode = false;
self.disable_linewrap = false;
self.cursor.change_shape(CursorShape::Block);
self.cursor.change_shape(CursorShape::Initial);
self.output_buffer.update_all_lines();
self.changed_colors = None;
}
@ -1821,7 +1821,8 @@ impl Perform for Grid {
// DECSCUSR (CSI Ps SP q) -- Set Cursor Style.
let cursor_style_id = next_param_or(0);
let shape = match cursor_style_id {
0 | 2 => Some(CursorShape::Block),
0 => Some(CursorShape::Initial),
2 => Some(CursorShape::Block),
1 => Some(CursorShape::BlinkingBlock),
3 => Some(CursorShape::BlinkingUnderline),
4 => Some(CursorShape::Underline),

View File

@ -724,6 +724,7 @@ impl IndexMut<CharsetIndex> for Charsets {
#[derive(Clone, Copy, Debug)]
pub enum CursorShape {
Initial,
Block,
BlinkingBlock,
Underline,
@ -750,7 +751,7 @@ impl Cursor {
is_hidden: false,
pending_styles: CharacterStyles::new(),
charsets: Default::default(),
shape: CursorShape::Block,
shape: CursorShape::Initial,
}
}
pub fn change_shape(&mut self, shape: CursorShape) {

View File

@ -344,7 +344,8 @@ impl Pane for TerminalPane {
}
fn cursor_shape_csi(&self) -> String {
match self.grid.cursor_shape() {
CursorShape::Block => "\u{1b}[0 q".to_string(),
CursorShape::Initial => "\u{1b}[0 q".to_string(),
CursorShape::Block => "\u{1b}[2 q".to_string(),
CursorShape::BlinkingBlock => "\u{1b}[1 q".to_string(),
CursorShape::Underline => "\u{1b}[4 q".to_string(),
CursorShape::BlinkingUnderline => "\u{1b}[3 q".to_string(),