switch to termini for terminfo

This commit is contained in:
Pascal Kuthe 2022-10-06 20:46:24 +02:00
parent 71ee589bbc
commit 114610f7dc
No known key found for this signature in database
GPG key ID: D715E8655AE166A6
3 changed files with 14 additions and 11 deletions

17
Cargo.lock generated
View file

@ -176,12 +176,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "cxterminfo"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da92c5e3aaf2cc1fea346d9b3bac0c59c6ffc1d1d46f18d991d449912a3e6f07"
[[package]] [[package]]
name = "dirs-next" name = "dirs-next"
version = "2.0.0" version = "2.0.0"
@ -510,10 +504,10 @@ dependencies = [
"bitflags", "bitflags",
"cassowary", "cassowary",
"crossterm", "crossterm",
"cxterminfo",
"helix-core", "helix-core",
"helix-view", "helix-view",
"serde", "serde",
"termini",
"unicode-segmentation", "unicode-segmentation",
] ]
@ -1105,6 +1099,15 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "termini"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00733d628ac0a8bd4fd3171a28eb6c09759ae1b43d8b587eadebaccee01d01a3"
dependencies = [
"dirs-next",
]
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.15.1" version = "0.15.1"

View file

@ -20,7 +20,7 @@ bitflags = "1.3"
cassowary = "0.3" cassowary = "0.3"
unicode-segmentation = "1.10" unicode-segmentation = "1.10"
crossterm = { version = "0.25", optional = true } crossterm = { version = "0.25", optional = true }
cxterminfo = "0.2" termini = "0.1"
serde = { version = "1", "optional" = true, features = ["derive"]} serde = { version = "1", "optional" = true, features = ["derive"]}
helix-view = { version = "0.6", path = "../helix-view", features = ["term"] } helix-view = { version = "0.6", path = "../helix-view", features = ["term"] }
helix-core = { version = "0.6", path = "../helix-core" } helix-core = { version = "0.6", path = "../helix-core" }

View file

@ -27,13 +27,13 @@ impl Capabilities {
/// on the $TERM environment variable. If detection fails, returns /// 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.
pub fn from_env_or_default() -> Self { pub fn from_env_or_default() -> Self {
match cxterminfo::terminfo::TermInfo::from_env() { match termini::TermInfo::from_env() {
Err(_) => Capabilities::default(), Err(_) => Capabilities::default(),
Ok(t) => Capabilities { Ok(t) => Capabilities {
// Smulx, VTE: https://unix.stackexchange.com/a/696253/246284 // Smulx, VTE: https://unix.stackexchange.com/a/696253/246284
// Su (used by kitty): https://sw.kovidgoyal.net/kitty/underlines // Su (used by kitty): https://sw.kovidgoyal.net/kitty/underlines
has_extended_underlines: t.get_ext_string("Smulx").is_some() has_extended_underlines: t.extended_cap("Smulx").is_some()
|| *t.get_ext_bool("Su").unwrap_or(&false) || t.extended_cap("Su").is_some()
|| vte_version() >= Some(5102), || vte_version() >= Some(5102),
}, },
} }