aboutsummaryrefslogtreecommitdiff
path: root/helix-tui/src/backend
diff options
context:
space:
mode:
authorKhang Nguyen Duy2024-03-19 11:12:37 +0000
committerGitHub2024-03-19 11:12:37 +0000
commit4d2282cbccff4dd0aaa901a3ea4fb28a2b8120aa (patch)
tree586ef72a3a71ad19e62ec1abef7dcbd0c6feec46 /helix-tui/src/backend
parent3d4889ce9a24f485cf0816b69b8e1f579eee0bdd (diff)
Respect undercurl config even with no terminfo (#9897)
I have just found out that my recent Windows Terminal version supported rendering undercurl (see https://devblogs.microsoft.com/commandline/windows-terminal-preview-1-20-release ). However, looking at the source, terminfo is required for helix to emit the undercurl control code, which isn't available on Windows AFAIK. This commit make helix respects the `editor.undercurl` option when there is no terminfo. Tested on Windows Terminal Preview 1.20 Signed-off-by: Khang Nguyen <khang.nguyenduycse@hcmut.edu.vn>
Diffstat (limited to 'helix-tui/src/backend')
-rw-r--r--helix-tui/src/backend/crossterm.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/helix-tui/src/backend/crossterm.rs b/helix-tui/src/backend/crossterm.rs
index 88e70f32..37721e89 100644
--- a/helix-tui/src/backend/crossterm.rs
+++ b/helix-tui/src/backend/crossterm.rs
@@ -52,10 +52,14 @@ impl Default for Capabilities {
impl Capabilities {
/// Detect capabilities from the terminfo database located based
/// on the $TERM environment variable. If detection fails, returns
- /// a default value where no capability is supported.
+ /// a default value where no capability is supported, or just undercurl
+ /// if config.undercurl is set.
pub fn from_env_or_default(config: &EditorConfig) -> Self {
match termini::TermInfo::from_env() {
- Err(_) => Capabilities::default(),
+ Err(_) => Capabilities {
+ has_extended_underlines: config.undercurl,
+ ..Capabilities::default()
+ },
Ok(t) => Capabilities {
// Smulx, VTE: https://unix.stackexchange.com/a/696253/246284
// Su (used by kitty): https://sw.kovidgoyal.net/kitty/underlines