Skip to content

Commit

Permalink
Detect WezTerm and mark it as undercurl/Smulx capable
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Dec 2, 2022
1 parent e926518 commit 98c121c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion helix-tui/src/backend/crossterm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ use std::{
fmt,
io::{self, Write},
};

fn term_program() -> Option<String> {
std::env::var("TERM_PROGRAM").ok()
}
fn vte_version() -> Option<usize> {
std::env::var("VTE_VERSION").ok()?.parse().ok()
}
Expand All @@ -35,9 +39,11 @@ impl Capabilities {
Ok(t) => Capabilities {
// Smulx, VTE: https://unix.stackexchange.com/a/696253/246284
// Su (used by kitty): https://sw.kovidgoyal.net/kitty/underlines
// WezTerm supports underlines but a lot of distros don't properly install it's terminfo
has_extended_underlines: t.extended_cap("Smulx").is_some()
|| t.extended_cap("Su").is_some()
|| vte_version() >= Some(5102),
|| vte_version() >= Some(5102)
|| matches!(term_program().as_deref(), Some("WezTerm")),
},
}
}
Expand Down

0 comments on commit 98c121c

Please sign in to comment.