From bed3c856ede8f89cc38ab9f29755c4e5e371d17c Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 13 Aug 2026 15:00:24 +0800 Subject: [PATCH] fix(panel): redraw the right panel's tab icons and put the tree glyph on the tile ladder (#578) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(panel): redraw the right panel's three tab icons The tiles render at 13px (`TILE_GLYPH`), and at that size the set had three problems, none of them about style: - `info` and `folder-closed` were both a rounded body split by a horizontal rule at nearly the same proportions, so the first and third tile could only be told apart by a notch a pixel and a half wide. - `git-branch` drew its three nodes as filled r=2.5 discs — 2.7px across at render size — which buried the 2.1 strokes between them and left the glyph reading as three dots. - The interior detail was too dense to survive: `info` carried two rules 4.8 units apart and `folder-closed` a divider 3.2 units below its front edge, both under 2.6px once rendered. Same three metaphors, same 2.1 pen, same rounded joins — only the geometry moves. The nodes go hollow so the branch is drawn with one pen rather than two. The crowded interior rules go, which leaves the folder a clean body and makes the notch the thing that separates it from `info`, rather than a second rule at a slightly different height. And each mark grows into the height `panel-right` already occupies beside them: the three had the width of that box and sat two units short of its height, which on a row of tiles reads as three smaller icons rather than as three different ones. Measured as rendered ink, stroke included, on the 24 grid: | glyph | before | after | | ----------------------------------- | ----------- | ----------- | | `panel-right` (unchanged reference) | 19.3 x 19.3 | — | | `info` | 19.3 x 17.3 | 19.3 x 18.1 | | `folder-closed` | 19.3 x 17.3 | 19.3 x 17.7 | | `git-branch` | 18.5 x 17.3 | 18.3 x 18.9 | All three stay centred on 12, 12. * fix(files): size the tree row's glyph off the tile ladder, not the rem one Glyphs in this window come from the pixel ladder in `app.rs` — `TILE_GLYPH` 13 for a chrome tile, `TILE_GLYPH_XS` 11 for the tiles a row reveals on hover — while text comes from the rem ramp. The file tree's leading folder/file mark was the one place drawing its size from gpui-component's rem sizes instead, and those two systems cannot meet: at the default `ui_font_size` of 16 the rem ladder offers `xsmall` 12 and `small` 14 and nothing in between, so the mark was always a step under the tab tiles above it — a speck beside a 14px name — or a step over them, which is a row of content outsizing the navigation that owns it. `ROW_GLYPH` is that size named once, in pixels, next to the panel's type ramp and defined as the tab tile's own glyph, so the two now agree by construction rather than by coincidence. * fix(icons): put the tree's collapsed folder on the set's box `folder.svg` is the one folder the set never squared up. It inks 19.9 x 16.1 where every other mark in the row is 19.3 wide, because its top edge overshoots the box by 0.6 on the right — which also leaves the whole glyph 0.3 off-centre that way, and 0.2 low. Nothing showed while the tree drew it a step under the chrome. It is on `ROW_GLYPH` now, the same 13px as the Files tab tile above it, and it swaps in place with `folder-open` — already on the box — every time a directory opens or closes, so the overhang is a shift in a fixed column rather than a number in a file. Same folder, same 2.8 corners, same 1.7 shoulder: the top edge gives back the 0.6 it overshot and the body takes the 1.2 of height that puts it on 19.3 x 17.3, centred on 12, 12, which is where `folder-open` and the rest of the row already are. --------- Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> --- assets/icons/folder-closed.svg | 2 +- assets/icons/folder.svg | 2 +- assets/icons/git-branch.svg | 2 +- assets/icons/info.svg | 2 +- src/ui/file_tree.rs | 6 +++--- src/ui/right_panel.rs | 13 +++++++++++++ 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/assets/icons/folder-closed.svg b/assets/icons/folder-closed.svg index c38c3d9a..238f7f2b 100644 --- a/assets/icons/folder-closed.svg +++ b/assets/icons/folder-closed.svg @@ -1 +1 @@ - + diff --git a/assets/icons/folder.svg b/assets/icons/folder.svg index cd3dc093..cc1085ef 100644 --- a/assets/icons/folder.svg +++ b/assets/icons/folder.svg @@ -1 +1 @@ - + diff --git a/assets/icons/git-branch.svg b/assets/icons/git-branch.svg index 459edbfa..2c377698 100644 --- a/assets/icons/git-branch.svg +++ b/assets/icons/git-branch.svg @@ -1 +1 @@ - + diff --git a/assets/icons/info.svg b/assets/icons/info.svg index 63ac0e3c..20df845b 100644 --- a/assets/icons/info.svg +++ b/assets/icons/info.svg @@ -1 +1 @@ - + diff --git a/src/ui/file_tree.rs b/src/ui/file_tree.rs index 53d9a0cd..e594548a 100644 --- a/src/ui/file_tree.rs +++ b/src/ui/file_tree.rs @@ -11,7 +11,7 @@ use crate::ui::file_copy; use crate::ui::host_ops::{ByHost, HostId, HostOps, InFlight, SharedHost, WatchSub}; use crate::ui::host_registry::HostRegistry; use crate::ui::i18n::{L10nKey, t, t_fmt}; -use crate::ui::right_panel::git_badge; +use crate::ui::right_panel::{ROW_GLYPH, git_badge}; use crate::ui::scm::status::{status_color, status_glyph}; use gpui::prelude::*; use gpui::{ @@ -1798,7 +1798,7 @@ impl Tty7App { .cursor_pointer() .when(selected, |d| d.bg(gpui::rgb(sf.selected))) .when(!selected, |d| d.hover(|s| s.bg(gpui::rgb(sf.hover)))) - .child(Icon::new(icon).xsmall().text_color(if is_dir { + .child(Icon::new(icon).size(px(ROW_GLYPH)).text_color(if is_dir { cx.theme().foreground } else { muted @@ -2081,7 +2081,7 @@ impl gpui::Render for DragGhost { .border_1() .border_color(cx.theme().border) .text_sm() - .child(Icon::new(IconName::File).xsmall()) + .child(Icon::new(IconName::File).size(px(ROW_GLYPH))) .child(SharedString::from(self.name.clone())) } } diff --git a/src/ui/right_panel.rs b/src/ui/right_panel.rs index f1f3913e..2114d704 100644 --- a/src/ui/right_panel.rs +++ b/src/ui/right_panel.rs @@ -46,6 +46,19 @@ pub(crate) const META_MONO: f32 = META - STEP; /// sidebar's group headings, which are the same thing one panel over. pub(crate) const HEADING: f32 = 11. * STEP; +/// The leading glyph on a panel row — the file tree's folder and file marks. +/// +/// Pixels, not rems, because glyphs in this window are sized off the tile +/// ladder in `app.rs` (`TILE_GLYPH` 13, `TILE_GLYPH_XS` 11) rather than off the +/// text ramp above. A row that reached for gpui-component's rem sizes instead +/// could never agree with the tab tiles it sits under: at the default +/// `ui_font_size` of 16 that ladder offers `xsmall` 12 and `small` 14 and +/// nothing between, so the tree's glyph came out either a step under the +/// chrome — reading as a speck beside a 14px name — or a step over it, which +/// puts a row of content above the navigation that owns it. 13 is the tab +/// tile's own glyph size, so the two agree by construction. +pub(crate) const ROW_GLYPH: f32 = crate::ui::app::TILE_GLYPH; + // The right panel's type ramp: four steps, a point apart, that the Info and // Source Control tabs both draw from so switching between them does not change // the apparent size of the panel. The Files tab, in `file_tree.rs`, reaches the