on master help sign in
Detect WezTerm and mark it as undercurl/Smulx capable
98c121cBlaž Hrastnik
helix-tui/src/backend/crossterm.rs+7−1
@@ -14,6 +14,10 @@ use std::{
14 fmt,
14 fmt,
15 io::{self, Write},
15 io::{self, Write},
16};
16};
17+
18+fn term_program() -> Option<String> {
19+ std::env::var("TERM_PROGRAM").ok()
20+}
17fn vte_version() -> Option<usize> {
21fn vte_version() -> Option<usize> {
18 std::env::var("VTE_VERSION").ok()?.parse().ok()
22 std::env::var("VTE_VERSION").ok()?.parse().ok()
19}
23}
@@ -35,9 +39,11 @@ impl Capabilities {
35 Ok(t) => Capabilities {
39 Ok(t) => Capabilities {
36 // Smulx, VTE: https://unix.stackexchange.com/a/696253/246284
40 // Smulx, VTE: https://unix.stackexchange.com/a/696253/246284
37 // Su (used by kitty): https://sw.kovidgoyal.net/kitty/underlines
41 // Su (used by kitty): https://sw.kovidgoyal.net/kitty/underlines
42+ // WezTerm supports underlines but a lot of distros don't properly install it's terminfo
38 has_extended_underlines: t.extended_cap("Smulx").is_some()
43 has_extended_underlines: t.extended_cap("Smulx").is_some()
39 || t.extended_cap("Su").is_some()
44 || t.extended_cap("Su").is_some()
40− || vte_version() >= Some(5102),
45+ || vte_version() >= Some(5102)
46+ || matches!(term_program().as_deref(), Some("WezTerm")),
41 },
47 },
42 }
48 }
43 }
49 }