mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
follow neovim's truecolor detection (#9577)
This commit is contained in:
parent
581a1ebf5d
commit
786b5c533e
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1387,6 +1387,7 @@ dependencies = [
|
|||||||
"signal-hook-tokio",
|
"signal-hook-tokio",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
|
"termini",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"toml",
|
"toml",
|
||||||
|
@ -42,6 +42,7 @@ signal-hook = "0.3"
|
|||||||
tokio-stream = "0.1"
|
tokio-stream = "0.1"
|
||||||
futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
|
futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
|
||||||
arc-swap = { version = "1.6.0" }
|
arc-swap = { version = "1.6.0" }
|
||||||
|
termini = "1"
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
fern = "0.6"
|
fern = "0.6"
|
||||||
|
@ -22,17 +22,30 @@
|
|||||||
|
|
||||||
pub use keymap::macros::*;
|
pub use keymap::macros::*;
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
|
||||||
fn true_color() -> bool {
|
|
||||||
std::env::var("COLORTERM")
|
|
||||||
.map(|v| matches!(v.as_str(), "truecolor" | "24bit"))
|
|
||||||
.unwrap_or(false)
|
|
||||||
}
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn true_color() -> bool {
|
fn true_color() -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
fn true_color() -> bool {
|
||||||
|
if matches!(
|
||||||
|
std::env::var("COLORTERM").map(|v| matches!(v.as_str(), "truecolor" | "24bit")),
|
||||||
|
Ok(true)
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
match termini::TermInfo::from_env() {
|
||||||
|
Ok(t) => {
|
||||||
|
t.extended_cap("RGB").is_some()
|
||||||
|
|| t.extended_cap("Tc").is_some()
|
||||||
|
|| (t.extended_cap("setrgbf").is_some() && t.extended_cap("setrgbb").is_some())
|
||||||
|
}
|
||||||
|
Err(_) => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Function used for filtering dir entries in the various file pickers.
|
/// Function used for filtering dir entries in the various file pickers.
|
||||||
fn filter_picker_entry(entry: &DirEntry, root: &Path, dedup_symlinks: bool) -> bool {
|
fn filter_picker_entry(entry: &DirEntry, root: &Path, dedup_symlinks: bool) -> bool {
|
||||||
// We always want to ignore the .git directory, otherwise if
|
// We always want to ignore the .git directory, otherwise if
|
||||||
|
Loading…
Reference in New Issue
Block a user