From 4b1e78cd5c4ed69a168409620a272fc63fa2f433 Mon Sep 17 00:00:00 2001 From: Miao Date: Thu, 18 Sep 2025 16:15:52 +0800 Subject: [PATCH] terminal: Fix COLORTERM regression for true color support (#38379) Closes #38304 Release Notes: - Fixed true color detection regression by setting `COLORTERM=truecolor` --- Reason: The regression is possibly introduced in [pr#36576: Inject venv environment via the toolchain](https://github.com/zed-industries/zed/pull/36576/files#diff-6f30387876b79f1de44f8193401d6c8fb49a2156479c4f2e32bc922ec5d54d76), where `alacritty_terminal::tty::setup_env();` is removed. The `alacritty_terminal::tty::setup_env();` does 2 things, which sets `TERM` & `COLORTERM` envvar. ```rs /// Setup environment variables. pub fn setup_env() { // Default to 'alacritty' terminfo if it is available, otherwise // default to 'xterm-256color'. May be overridden by user's config // below. let terminfo = if terminfo_exists("alacritty") { "alacritty" } else { "xterm-256color" }; unsafe { env::set_var("TERM", terminfo) }; // Advertise 24-bit color support. unsafe { env::set_var("COLORTERM", "truecolor") }; } ``` --- crates/terminal/src/terminal.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index a07aef5f7b4da90373bcbf7c406dd8277cb09387..0fce02a97b04484b5a91d6d43b456ecfb1f75f15 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -364,6 +364,7 @@ impl TerminalBuilder { env.insert("ZED_TERM".to_string(), "true".to_string()); env.insert("TERM_PROGRAM".to_string(), "zed".to_string()); env.insert("TERM".to_string(), "xterm-256color".to_string()); + env.insert("COLORTERM".to_string(), "truecolor".to_string()); env.insert( "TERM_PROGRAM_VERSION".to_string(), release_channel::AppVersion::global(cx).to_string(),