Repository navigation
fix(sidebar): keep the tab color strip clear of the tab icon - #632
Conversation
The GPUI sidebar copied the legacy shell's color strip offset (left 4, width 2.5), which the legacy shell paired with a 14px content inset. The GPUI row pads its content by only 8px, so the strip ended 1.5px from the tab icon and read as part of it. Derive the strip offset from the row padding so the strip always keeps a 4.5px gap to the icon, and the two values cannot drift apart again. The icon column and its alignment with the TABS disclosure arrow are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kuddev
left a comment
There was a problem hiding this comment.
Found a font-scaling regression in the otherwise focused strip-spacing fix. Reviewed the supplied Windows/Nord comparison and the exact pinned GPUI implementations; the screenshot covers one font size and does not establish that the icon/title positions remain unchanged. Please preserve the existing row-padding units before merging.
| .overflow_hidden() | ||
| .gap_2() | ||
| .px_2() | ||
| .px(px(TAB_ROW_PAD_X)) |
There was a problem hiding this comment.
[P2] Preserve the existing rem-based row padding. In pinned GPUI a71e175, px_2() is generated as rems(0.5), not an unconditional 8 logical pixels (gpui_macros/src/styles.rs:948-951). Pinned gpui-component e95f47d sets each window's rem size from cx.theme().font_size in Root::render, and this application's theme.rs:775 uses the configured UI font size with a 14px default. Consequently this replacement moves the icon/title start from 7px to 8px at the default size, and from 12px to 8px at a 24px UI size, while the TABS/header padding still scales. This contradicts the stated unchanged-column scope and breaks alignment for custom font sizes. Keep the existing padding unit and derive the strip geometry from the actual resolved padding, including small-font bounds; check at least the default and an enlarged UI font size. This finding is from the actual style/Root/theme code, not an additional visual run.
There was a problem hiding this comment.
Thanks, confirmed: px_2() is rems(0.5) and Root sets the rem size from theme.font_size, so the fixed 8px was wrong.
Fixed in 0102365. px_2() is restored and unchanged. The strip now sits at the row's left edge (.left_0()) instead of the legacy 4px inset, so its gap to the content is 0.5rem − 2.5px and scales with the UI font: 2.5 / 4.5 / 9.5px at 10 / 14 / 24px. I checked 14px and 24px in a real window; screenshots are in the updated description.
I also tried keeping a fixed 4.5px gap derived from window.rem_size(). At 24px the strip then floats inside the padding and reads like a glyph in front of the title, so I dropped that approach.
…row edge The previous commit replaced `px_2()` with a fixed 8px padding on the assumption that px_2 resolves to 8px. In pinned GPUI it is `rems(0.5)`, and gpui-component's Root sets the rem size from the UI font size (14px by default, clamped to 10-24px), so the padding is 7px at the default size. The fixed value moved the icon column by 1px at the default size and broke its alignment with the scaling TABS header at other sizes. Restore `px_2()` and drop the legacy 4px inset: the strip sits at the row's left edge, so its gap to the content is padding minus strip width and scales with the UI font: 2.5px at 10px, 4.5px at 14px, 9.5px at 24px. A fixed gap was tried and rejected: at 24px the strip floated in the padding and read as a glyph in front of the title. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge-base changed after approval.
Result / 用户结果
给标签设置颜色后,侧栏标签行左侧的色条紧贴着标签图标(默认界面字号下,色条右缘距内容起点只有 0.5px),看起来像图标的一部分,而不是独立的标签色标记。修复后色条贴住标签行左缘,与内容之间的间隙等于行内边距减去色条宽度,随界面字号一起缩放。图标、标题的位置以及它们与 TABS 折叠箭头的对齐都不变。
px_2= 0.5rem)原始截图:修复前 14px · 修复后 14px · 修复后 24px
(Windows 11、100% 缩放、Nord 主题下的实际窗口像素,对比图为 4 倍最近邻放大。修复前截自已安装的 2.2.0(2fde458)。修复后 24px 截自本 PR 当前 head。修复后 14px 截自本分支的中间版本,那一版在 14px 下的色条位置同样解析为 0,与当前 head 像素一致。)
Design / 设计边界
nebula_app/src/gpui_shell/workspace/sidebar.rs中侧栏标签色条的水平位置:.left(px(4.0))→.left_0(),并更新对应注释。display/chrome.rs的色条左内缩 4,但旧壳的内容起点是tab_x + 14(chrome.rs中的text_x)。GPUI 标签行的内边距是px_2()=rems(0.5),rem 由 gpui-componentRoot::render按theme.font_size设置(root.rs:555),默认 14px(theme.rs:775),设置里限定为 10–24px(nebula_settings/src/lib.rs:1191),所以内边距在 5–12px 之间。左内缩 4 时,色条到内容的间隙是 0.5rem − 6.5px:默认字号只剩 0.5px,最小字号下变成 −1.5px,色条会压到图标上。px_2()换成了固定 8px,把它当成了固定像素值。评审指出这是错的,已撤回,感谢。window.rem_size()推出色条位置,保持固定 4.5px 间隙。结果在 24px 下色条悬在内边距中间,看起来像标题前多了一个|字符,没有采用。Evidence / 验证依据
cargo build --locked -p nebula --bin pebrel --features gpui-shell:通过(Windows 11,dev profile)。rustfmt --edition 2024 --check nebula_app/src/gpui_shell/workspace/sidebar.rs:通过。python scripts/check_architecture.py --base origin/main:通过(exit 0,只有与本改动无关的既有 tighten NOTICE)。cargo test各套件(含file_line_budget)、cargo clippy、i18n 合同测试、非 Windows 平台。上一版 head 的 CI 全部通过,当前 head 的 CI 待跑。status-probe测试用的是一行复刻的探针,测不到真实标签行;照这个方式给色条写测试,只是把同一份样式再抄一遍,真实行改了它也发现不了。效果以上面两个字号的真实窗口截图验证。Required Review / 必须确认
CONTRIBUTING.md,docs/architecture.md, anddocs/project-constraints.md.python3 scripts/check_architecture.py --base <PR-base-commit>passes; budgets were not inflated to fit the change.🤖 Generated with Claude Code