From dd57077e0c215b868034a80d2fd3e1a89ca986f2 Mon Sep 17 00:00:00 2001 From: JoeAllen <2494136784@qq.com> Date: Mon, 12 Oct 2026 19:31:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(theme):=20=E4=BF=AE=E5=A4=8D=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=BE=AA=E7=8E=AF=E8=A2=AB=20bisect=20=E6=AE=8B?= =?UTF-8?q?=E7=95=99=E8=A6=86=E7=9B=96=E2=80=94=E2=80=94=E4=BA=AE=E8=89=B2?= =?UTF-8?q?=E9=A2=84=E8=AE=BE=E5=85=A8=E9=83=A8=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Solarized Light 等亮色预设不生效的根因:此前栈溢出二分时 register_bundled_themes 被改为「只注册 catppuccin 4 个」的探针版, 后续恢复只还原了 truncate 而漏掉了注册循环本体(BUNDLED_THEME_FILES 全量循环留在 0..0 死代码里)。暗色预设(Catppuccin Mocha)碰巧可用, 亮色一律回退深色。 恢复全量注册循环;39 个预设名(Linear + 38)注册验证通过; Catppuccin Mocha / Solarized Light 双预设实机截图验证生效。 顺带移除排查期临时打点,恢复用户 settings 为 system/linear。 --- gpui-app/src/lib.rs | 1 + gpui-app/src/ui/app/theme.rs | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/gpui-app/src/lib.rs b/gpui-app/src/lib.rs index 7a245b5..650b59a 100644 --- a/gpui-app/src/lib.rs +++ b/gpui-app/src/lib.rs @@ -19,6 +19,7 @@ pub fn init_themes(cx: &mut gpui_kit::App) { ui::app::theme::register_bundled_themes(cx); } + pub mod aliyun; pub mod model; pub mod mqtt; diff --git a/gpui-app/src/ui/app/theme.rs b/gpui-app/src/ui/app/theme.rs index 39470b9..af823e9 100644 --- a/gpui-app/src/ui/app/theme.rs +++ b/gpui-app/src/ui/app/theme.rs @@ -61,7 +61,6 @@ pub const LINEAR_PRESET_LABEL: &str = "Linear"; /// Linear Light/Dark(重名跳过,幂等)→ 把当前明暗对指向 Linear → 再 `change` /// 应用其颜色/字号/圆角。 pub fn apply_theme(pref: ThemeModePref, cx: &mut App) { - eprintln!("[THM] apply_theme enter"); let mode = match pref { ThemeModePref::Light => ThemeMode::Light, ThemeModePref::Dark => ThemeMode::Dark, @@ -89,22 +88,11 @@ pub fn apply_theme(pref: ThemeModePref, cx: &mut App) { /// 注册全部官方捆绑预设(幂等,重名由 ThemeRegistry 覆盖/跳过)。 /// 启动时调用一次。 pub fn register_bundled_themes(cx: &mut App) { - eprintln!("[THM] register START"); - // [bisect] 只注册 catppuccin 4 个 - if let Err(e) = ThemeRegistry::global_mut(cx) - .load_themes_from_str(include_str!("../../../themes/catppuccin.json")) - { - eprintln!("加载捆绑主题预设失败: {e}"); - } - eprintln!("[THM] register catppuccin done"); - #[allow(clippy::needless_range_loop)] - for _i in 0..0 { for json in BUNDLED_THEME_FILES { if let Err(e) = ThemeRegistry::global_mut(cx).load_themes_from_str(json) { eprintln!("加载捆绑主题预设失败: {e}"); } } - } } /// 应用官方捆绑预设(settings.theme_preset ≠ "linear" 时的路径)。 @@ -112,7 +100,6 @@ pub fn register_bundled_themes(cx: &mut App) { /// 经 Theme::update 走官方 reconcile + sync + 全窗刷新。 /// 名字不存在(理论不可达,测试拦截)时返回 false 回退 Linear。 pub fn apply_theme_preset(name: &str, cx: &mut App) -> bool { - eprintln!("[THM] apply_theme_preset enter ({name})"); let config = ThemeRegistry::global(cx).themes().get(name).cloned(); let Some(config) = config else { return false; @@ -123,7 +110,6 @@ pub fn apply_theme_preset(name: &str, cx: &mut App) -> bool { /// 预设展示名单:Linear 在首,其余按名字排序(与 ThemeRegistry 一致)。 pub fn theme_preset_names(cx: &App) -> Vec { - eprintln!("[THM] theme_preset_names enter"); let mut names: Vec = ThemeRegistry::global(cx) .themes() .keys()