@@ -32,10 +32,21 @@ fn vte_version() -> Option<usize> {
3232}
3333
3434/// Describes terminal capabilities like extended underline, truecolor, etc.
35−#[derive(Copy, Clone, Debug, Default)]
35+#[derive(Clone, Debug)]
3636struct Capabilities {
3737 /// Support for undercurled, underdashed, etc.
3838 has_extended_underlines: bool,
39+ /// Support for resetting the cursor style back to normal.
40+ reset_cursor_command: String,
41+}
42+
43+impl Default for Capabilities {
44+ fn default() -> Self {
45+ Self {
46+ has_extended_underlines: false,
47+ reset_cursor_command: "\x1B[0 q".to_string(),
48+ }
49+ }
3950}
4051
4152impl Capabilities {
@@ -54,6 +65,10 @@ impl Capabilities {
5465 || t.extended_cap("Su").is_some()
5566 || vte_version() >= Some(5102)
5667 || matches!(term_program().as_deref(), Some("WezTerm")),
68+ reset_cursor_command: t
69+ .utf8_string_cap(termini::StringCapability::CursorNormal)
70+ .unwrap_or("\x1B[0 q")
71+ .to_string(),
5772 },
5873 }
5974 }
@@ -154,7 +169,8 @@ where
154169
155170 fn restore(&mut self, config: Config) -> io::Result<()> {
156171 // reset cursor shape
157− write!(self.buffer, "\x1B[0 q")?;
172+ self.buffer
173+ .write_all(self.capabilities.reset_cursor_command.as_bytes())?;
158174 if config.enable_mouse_capture {
159175 execute!(self.buffer, DisableMouseCapture)?;
160176 }