Skip to content

Commit

Permalink
Revert "Use terminfo to reset terminal cursor style (helix-editor#8591)"
Browse files Browse the repository at this point in the history
This reverts commit 553ffbc.
  • Loading branch information
kladd committed Nov 16, 2023
1 parent 32372b2 commit 2df38ac
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions helix-tui/src/backend/crossterm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,10 @@ fn vte_version() -> Option<usize> {
}

/// Describes terminal capabilities like extended underline, truecolor, etc.
#[derive(Clone, Debug)]
#[derive(Copy, Clone, Debug, Default)]
struct Capabilities {
/// Support for undercurled, underdashed, etc.
has_extended_underlines: bool,
/// Support for resetting the cursor style back to normal.
reset_cursor_command: String,
}

impl Default for Capabilities {
fn default() -> Self {
Self {
has_extended_underlines: false,
reset_cursor_command: "\x1B[0 q".to_string(),
}
}
}

impl Capabilities {
Expand All @@ -65,10 +54,6 @@ impl Capabilities {
|| t.extended_cap("Su").is_some()
|| vte_version() >= Some(5102)
|| matches!(term_program().as_deref(), Some("WezTerm")),
reset_cursor_command: t
.utf8_string_cap(termini::StringCapability::CursorNormal)
.unwrap_or("\x1B[0 q")
.to_string(),
},
}
}
Expand Down Expand Up @@ -169,8 +154,7 @@ where

fn restore(&mut self, config: Config) -> io::Result<()> {
// reset cursor shape
self.buffer
.write_all(self.capabilities.reset_cursor_command.as_bytes())?;
write!(self.buffer, "\x1B[0 q")?;
if config.enable_mouse_capture {
execute!(self.buffer, DisableMouseCapture)?;
}
Expand Down

0 comments on commit 2df38ac

Please sign in to comment.