Skip to content

Cosmetic: Better align the ref labels - reading low in their capsules - #690

Merged
hannesa2 merged 2 commits into
masterfrom
pad-the-ref-label-capsules
Sep 19, 2026
Merged

hannesa2 merged 2 commits into
masterfrom
pad-the-ref-label-capsules

Conversation

@goneng

@goneng goneng commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #683, against the remainder of #679.

#683 lined the subject and the short SHA up on the row and deliberately left the ref labels alone. With those two settled, the labels were the element still reading wrong, in the history rows and in the commit header alike.

The cause is not alignment. A label's capsule is the text's line box, which reserves room for an ascender and a descender that most branch names never both use. The glyphs therefore sit low in it, and a name ending in a descender comes to rest on the border with nothing underneath.

Measured off a real row, capsule spanning y=14..25:

name space above space below
master 4 rows 2 rows
origin/master 3 rows 0 rows
  • Lift the text a point inside the capsule, leaving the capsule the size it was. master becomes 3 and 3, origin/master 2 and 1.
  • Do the same in the details view, where the labels are HTML: a pixel off the top of the padding and a pixel onto the bottom, which is the stylesheet's equivalent of the same move.

The two commits are separable. The first is the history row, the second the commit header.

What was tried and rejected

Padding the capsule instead, so a descender would clear the border. It is the obvious move and it is wrong: growing the capsule by a point on each side preserves the ratio of air above the glyphs to air below and merely adds more of both. On screen the labels simply looked bloated, with the text no better placed. A test now pins the capsule's height so this does not get tried a second time.

What this does not change

The baseline. The labels sit on cap-height centring, which keeps master and MASTER sharing a baseline instead of drifting apart. Measured against the capsule, the ink centre still lands differently per name, and that spread is the font's rather than the cell's:

string ink centre in the capsule
MASTER centred
master 0.2 low
origin/master 0.7 low
a name of nothing but descenders 1.7 low

Centring each label's own ink would flatten that column but give adjacent labels different baselines, which is worse.

Expected results

image

Test plan

  • 3 new tests in PBGitRevisionCellLayoutTests: that the text is lifted above the capsule's top edge, that a descender no longer reaches the bottom border, and that the capsule stays the size of its text.
  • Full suite: 148 tests, 0 failures. The stylesheet change is not covered by the suite; it was checked by building and looking, after confirming the edited CSS reached the app bundle.
  • Built and run against this repository, comparing a row's labels against the same labels in the commit header below it.

@goneng goneng added the WIP Work in progress label Sep 19, 2026
A ref label's capsule is the text's line box, which reserves room for
an ascender and a descender that most branch names never both use, so
the glyphs sat low in it and a name ending in a descender came to rest
on the capsule's border with nothing underneath it.

* Lift the text a point inside the capsule rather than drawing it into
  the capsule itself. That balances the space above the glyphs against
  the space below and gives a descender its clearance, without the
  capsule changing size at all.
* Leave the capsule alone. Padding it was the first attempt and it is
  the wrong remedy: it preserves the ratio of air above the glyphs to
  air below and merely adds more of both, which reads worse.
* Cover the lift with tests, one of which pins the capsule's height so
  that the padding does not get tried a second time.

Leave the baseline where it is. The labels sit on cap-height centring,
which is what keeps master and MASTER sharing a baseline rather than
drifting apart from one another.
The details view lists the same labels in HTML, where the background
box covers the font's content area and the text sat low inside it for
the same reason it did in the history rows.

* Take a pixel off the top of the label's padding and add one to the
  bottom, lifting the text inside a capsule of unchanged height, which
  is the stylesheet's equivalent of the lift the cell now does.
@goneng
goneng force-pushed the pad-the-ref-label-capsules branch from 6dd9419 to daf26fe Compare September 19, 2026 14:11
@goneng goneng changed the title Give the ref labels room around their text Stop the ref labels reading low in their capsules Sep 19, 2026
@goneng goneng removed the WIP Work in progress label Sep 19, 2026
@goneng
goneng marked this pull request as ready for review September 19, 2026 14:13
@goneng goneng changed the title Stop the ref labels reading low in their capsules Cosmetic: Stop the ref labels reading low in their capsules Sep 19, 2026
@goneng goneng changed the title Cosmetic: Stop the ref labels reading low in their capsules Cosmetic: Better align the ref labels - reading low in their capsules Sep 19, 2026
@hannesa2

Copy link
Copy Markdown
Contributor

Screenshot differs: emulatorApi=arm64 with 4 screenshot(s)

setpoint (old) | diff | actual screenshot (new)

00-commit-context-menu.pngscreenshot

01-history-view.pngscreenshot

02-main-window.pngscreenshot

03-staging-view.pngscreenshot

@hannesa2
hannesa2 merged commit 2c875b9 into master Sep 19, 2026
3 checks passed
@hannesa2
hannesa2 deleted the pad-the-ref-label-capsules branch September 19, 2026 17:23
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.

2 participants