-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use terminfo to reset terminal cursor style #8591
Use terminfo to reset terminal cursor style #8591
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor style nits
8309d8c
to
3b51ef0
Compare
reset_cursor_command: t | ||
.utf8_string_cap(termini::StringCapability::CursorNormal) | ||
.unwrap_or("\x1B[0 q") | ||
.to_string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On unic thus seems fine but does this work on windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good catch, I just tried it out and it doesn't work on windows since the reset command will be set to an empty string instead.
3b51ef0
to
3e68e46
Compare
helix-tui/src/backend/crossterm.rs
Outdated
@@ -31,11 +31,22 @@ fn vte_version() -> Option<usize> { | |||
std::env::var("VTE_VERSION").ok()?.parse().ok() | |||
} | |||
|
|||
#[derive(Clone, Debug)] | |||
struct ResetCursorCommand(String); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newtype wrapper for the string here seems unnecessary to me. It's fine just to default with unwrap_or
/unwrap_or_else
rather than unwrap_or_default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this since we also want the default "\x1B[0 q"
to be used when terminfo
isn't available, for example on Windows, or else it just defaults to an empty string. Or should I just explicitly make the struct in the other case instead of keeping the Capabilities::default()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. Let's define impl Default for Capabilities
instead so Windows can keep calling Capabilities::default
3e68e46
to
ef0d1c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small style nit: I dislike using default instead of false. Apart from that this LGTM
ef0d1c6
to
758278e
Compare
The terminfos of the terminals on my machine have It seems like there's some adoption of |
This reverts commit 553ffbc.
This reverts commit 553ffbc.
This reverts commit 553ffbc.
This reverts commit 553ffbc.
Uses the
cnorm
capability fromterminfo
if available to reset the terminal cursor style. I tested this withxterm
and it seems to fix the issue with making the cursor blink like in #3741.Closes #2684