Skip to content

Commit 506ac26

Browse files
authored
Optimize color detection and add WSL support (#14603)
1 parent ff650e8 commit 506ac26

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

helix-term/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub mod job;
1212
pub mod keymap;
1313
pub mod ui;
1414

15+
use std::env::var_os;
1516
use std::path::Path;
1617

1718
use futures_util::Future;
@@ -27,10 +28,9 @@ fn true_color() -> bool {
2728

2829
#[cfg(not(windows))]
2930
fn true_color() -> bool {
30-
if matches!(
31-
std::env::var("COLORTERM").map(|v| matches!(v.as_str(), "truecolor" | "24bit")),
32-
Ok(true)
33-
) {
31+
if var_os("COLORTERM").is_some_and(|v| v == "truecolor" || v == "24bit")
32+
|| var_os("WSL_DISTRO_NAME").is_some()
33+
{
3434
return true;
3535
}
3636

0 commit comments

Comments
 (0)