Skip to content

fix(shell): one same-sized marker per shell, and space the picker rows - #111

Open
YinBuLiao wants to merge 1 commit into
Kuddev:mainfrom
YinBuLiao:fix/shell-icons-uniform
Open

fix(shell): one same-sized marker per shell, and space the picker rows#111
YinBuLiao wants to merge 1 commit into
Kuddev:mainfrom
YinBuLiao:fix/shell-icons-uniform

Conversation

@YinBuLiao

@YinBuLiao YinBuLiao commented Sep 11, 2026

Copy link
Copy Markdown

Result / 用户结果

  • Settings → 终端 的「默认 Shell」下拉里,图标有三种尺寸:品牌 PNG 24px、dev-terminal 字形约 0.7em、cod-terminal 字形约 0.9em;选中行还紧贴上一行,没有间隔。
  • 三点 / Ctrl+K 的新终端弹窗里,没有品牌贴图的 shell(zsh、csh、ksh、sh、dash、tcsh)整行左边没有图标

现在两个界面都回落到共享的 id-keyed 字形(shell_detect::icon_for_id),并按 FALLBACK_ICON_SCALE 配平到与品牌贴图同一视觉尺寸;设置下拉的图标槽固定为同一 SHELL_ROW_ICON_SIZE,行间距由 SHELL_ROW_GAP 提供。

无关联 issue:本地实测发现。

Design / 设计边界

  • Responsibility and affected modules: 字形与配平系数留在 nebula_app/src/shell_detect.rs(图标权威,旧壳与命令面板共用);两个消费者 gpui_shell/settings_pane/shell_picker.rsgpui_shell/workspace.rs + gpui_shell/workspace/palette.rs 只做适配。
  • Why this belongs here: icon_for_id 的文档本来就声明它 shared by detected shells and the settings row so a saved shell=<id> always draws the same mark;此前 GPUI 的两个界面一个没用它、一个只画品牌贴图。color_icon_png / icon_for_id / 持久化 id 语义不变。
  • Dependency, data-format, threading, or lifetime changes: 无。
  • Compatibility and fallback behavior: 有品牌贴图的 shell 行为不变;没有的从「无图标 / 异尺寸」变成统一的 id-keyed 字形。icon_for_id 把无品牌资产的 shell 统一到 cod-terminalU+EA85),有品牌资产的(pwsh / cmd)保留各自码位。

Evidence / 验证依据

  • 命令与结果:cargo test ... -- shell_row_geometry shell_palette shell_detect::20 passed / 0 failed
  • Regression(修复前会红):
    • shell_row_geometry::every_row_shares_one_icon_slot_height —— 修复前实测 [13.0, 24.0, 13.0](品牌行 24px,动作行与字形行 13px,这正是行背景溢出、叠到相邻行的来源)。现在断言 品牌行 == 字形行 == SHELL_ROW_ICON_SIZE,且动作行恰好高出 SHELL_ROW_GAP
    • shell_palette_falls_back_to_an_id_glyph_when_brand_art_is_absent —— 每个 shell 行恰好一种图标来源;无贴图行必须带 id 字形。
    • fallback_shell_marks_share_one_glyph_so_they_render_at_one_size —— 所有无品牌 shell 共用一个码位。
  • 行间距的实现依赖组件库「只量首行槽高、再拿它排所有行」且虚拟列表没有 gap_ycrates/ui/src/list/list.rs 注释明说)。这是唯一不 fork 组件库的着力点,已在常量文档中写明。
  • 未运行:python3 scripts/check_architecture.py --base c2deb16(本机 Python 3.9.6,检查器要求 3.11+)。人工确认无文件超预算、无新增依赖边。
  • 仅验证 macOS 构建;Windows 分支未改,未在 Windows 运行。
  • 未做打包应用验证。

Required Review / 必须确认

  • 已遵循 CONTRIBUTING.mddocs/architecture.mddocs/project-constraints.md
  • 按职责拆分,未新增重复的行为权威。
  • scripts/check_architecture.py 未能运行(环境缺 Python 3.11+,见上);未抬高任何预算。
  • 有回归测试;平台覆盖限制已说明。
  • 无新增 UI 文案。
  • 无治理变更。

与另外两个 PR(默认 Shell 解析、通知溢出)无文件冲突:同文件的改动落在不同区域,任意顺序合并均可。

The settings picker mixed a brand PNG (24 px), a `dev-terminal` glyph
(~0.7 em) and a `cod-terminal` glyph (~0.9 em), so icons rendered at three
different sizes; the new-tab palette passed no glyph at all, leaving zsh,
csh, ksh, sh, dash and tcsh without any icon.

Both surfaces now fall back to the shared id-keyed glyph from
`shell_detect::icon_for_id`, all at `FALLBACK_ICON_SCALE` so the glyph ink
matches the brand artwork's 12% safe margin (roughly 0.77 of the slot). The
picker also reserves one fixed icon slot per row, which removes the row
overlap, and spaces rows by exactly `SHELL_ROW_GAP` — the component's
virtual list has no item `gap_y`, so the measured first row is padded to act
as the slot height. A selected row no longer touches the row above it.
@YinBuLiao
YinBuLiao requested a review from Kuddev as a code owner September 11, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant