CodeWhale icon indicating copy to clipboard operation
CodeWhale copied to clipboard

Bug: 终端背景图片丢失

Open ShimuGuyue opened this issue 6 months ago • 3 comments

Description

当从一个已有的终端窗口新建终端并键入指令打开 TUI 时,若该终端使用了背景图片,背景图片会被一片纯色覆盖掉。

Steps to reproduce

  1. 为终端设置背景图片
  2. 打开一个终端
  3. 点击 + 在已有界面新建一个终端
  4. 在新终端内打开 TUI

Expected behavior

从终端窗口新建的终端应和直接启动的终端一样,键入命令打开 TUI 时保留终端背景。

Actual behavior

终端背景被一片纯色覆盖住。

Impact

从终端窗口新建终端时一定出现的问题。

除了观感不太好,没有其它影响,但一定会有很多人介意,

Environment

  • OS: Windows 11
  • codewhale version: v0.8.44
  • Install method: npm
  • codewhale doctor summary: nothing
  • Model/provider: not related
  • Terminal app: Windows Terminal
  • Shell: powershell, cmd ...

Logs, screenshots, or recordings

Image

ShimuGuyue avatar May 26 '26 17:05 ShimuGuyue

感谢报告。这个看起来不是某个模型/provider 问题,而是 TUI 当前会主动用主题的 surface_bg 填满整个画面:默认主题会画一层实色背景,所以 Windows Terminal 的背景图/透明背景会被盖住。

我先不关闭这个 issue。比较稳妥的修复方向不是让所有主题都透明(那会破坏很多现有配色和可读性),而是增加一个 opt-in 的 terminal/transparent 主题,让背景色使用终端默认值/Color::Reset,只保留必要的 ANSI 语义色。已有一个旧 PR #1831 做过类似探索,但目前需要重整后才能作为 v0.8.48 候选。

结论:问题有效,暂时保留 open;下一步应从 #1831 中收敛出一个小而可验证的透明终端主题 PR。

Hmbown avatar May 27 '26 10:05 Hmbown

Thanks again for the clear Windows Terminal report, @ShimuGuyue. I opened PR #2276 for the opt-in transparent-terminal path discussed above: it adds a terminal theme, with aliases like transparent and inherit, that uses terminal default backgrounds plus ANSI accents so background images and transparent palettes can show through.

I intentionally did not make every theme transparent by default, because that would change readability and contrast for existing users. This gives affected Windows Terminal users a v0.8.48 candidate path via /theme or settings while keeping the default theme stable.

Hmbown avatar May 27 '26 11:05 Hmbown

已通过 #2276 (78f8e119) 解决为一个显式 opt-in 路径:现在可以选择 terminal 主题(别名包括 transparent、inherit、follow-terminal),让 TUI 背景使用终端默认背景色,从而保留 Windows Terminal 的背景图/透明背景。默认主题保持不变,避免影响已有用户的可读性和对比度。

感谢 @ShimuGuyue 提供清晰的 Windows Terminal 复现和截图,也感谢 @Sskift 在 #1831 里的早期透明主题探索;#2276 已把这部分整理到当前 palette/schema 并加了 theme picker / theme QA 覆盖。请在下一版里用 /theme terminal 或 settings 试一下,如果启用该主题后背景图仍然被覆盖,请带截图重新打开。

Hmbown avatar May 31 '26 04:05 Hmbown