From 76761be79a500cb77904d78cf50d2f465fef4c87 Mon Sep 17 00:00:00 2001 From: Kyle Ladd Date: Wed, 15 Nov 2023 19:55:45 -0500 Subject: [PATCH] Revert "Use terminfo to reset terminal cursor style (#8591)" This reverts commit 553ffbcaa09847ec606539bddab8af1456450d73. --- helix-tui/src/backend/crossterm.rs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/helix-tui/src/backend/crossterm.rs b/helix-tui/src/backend/crossterm.rs index c55ab6bbd0bd1..52841f6ef9cc1 100644 --- a/helix-tui/src/backend/crossterm.rs +++ b/helix-tui/src/backend/crossterm.rs @@ -32,21 +32,10 @@ fn vte_version() -> Option { } /// 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 { @@ -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(), }, } } @@ -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)?; }