Repository navigation
Line up the elements of a history row - #683
Merged
Merged
Conversation
goneng
force-pushed
the
align-history-row-elements
branch
from
September 19, 2026 09:31
b90c2b8 to
c3ac80e
Compare
Contributor
|
I hope that merge of screenshot compare fix will detect here something |
goneng
force-pushed
the
align-history-row-elements
branch
from
September 19, 2026 11:07
af1c84f to
af112c8
Compare
goneng
force-pushed
the
align-history-row-elements
branch
2 times, most recently
from
September 19, 2026 13:03
2c13005 to
1bc60e9
Compare
A row was laid out by three different rules, so the commit subject, the short SHA and the ref labels each sat at a different height. * Centre the subject on the row instead of nudging it a point off, and lay every row out rather than only those carrying a graph line, which left the rest wherever the nib happened to put them. * Snap the result to the backing grid. Centring lands on a half point whenever the row and the text differ by an odd amount, and text off the pixel grid renders blurred on a 1x display. * Set the short SHA in Monaco, whose baseline sits a third of a point from the columns beside it where Menlo's sat three quarters away, and drop it a further point: hexadecimal has no descenders, so it reads high in a band sized for text that has them. * Cover the layout with tests over the rectangles the cell hands out, since none of this drawing is checkable any other way. The ref labels are deliberately untouched. Their capsule is the measured line box, the same height in every script, and where the glyphs sit inside it depends on the branch name rather than on anything the cell could offset.
goneng
force-pushed
the
align-history-row-elements
branch
from
September 19, 2026 13:24
1bc60e9 to
82b3fdb
Compare
Contributor
goneng
marked this pull request as ready for review
September 19, 2026 13:36
Contributor
|
Great, it detects some changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Fixes #679.
The subject was nudged a point above centre by hand, and only on rows that had a graph line, so it lined up neither with the columns beside it nor with the ref labels next to it.
-backingAlignedRect:options:, replacing the hand-rolledfloor()calls.Why the ref labels are untouched
The issue suggested the label text sits low inside its capsule. Measured against the capsule the cell actually draws, it does sit slightly low, by an amount that depends on the branch name:
MASTERmasterorigin/masterThat spread is inherent rather than a bug. The capsule is the measured line box, 13.0pt for every one of those strings and so the same in every script, and the baseline works out to cap-height centring, which is what keeps
masterandMASTERsharing a baseline instead of drifting apart from each other. Centring each label's own ink would break that.What is worth a separate look is clearance rather than placement: the capsule hugs the line box exactly, so a descender lands on the border with nothing under it. That is visible on
origin/master. Fixing it means padding the capsule vertically, the wayref_paddingalready pads it horizontally, and it moves every label rather than only the ones in this issue, so it does not belong in this change.The short SHA column
With the subject centred, the SHA stood out as the one column still off. It is the only monospaced cell in the row, and Menlo's ink sits higher inside its line box than the proportional font beside it, so centring the two line boxes identically still leaves the digits high.
Monaco at the same size puts the ink lower in the box, and its
centerYconstant goes to0where every other column sits at-1, which is the remaining point. That the SHA is deliberately a point below its neighbours is the trade: the eye follows the digits, not the box they sit in.This part was settled by measuring screenshots of a real build pixel by pixel, one change at a time, rather than by reasoning about font metrics, which twice pointed the wrong way.
Why the backing alignment matters
Centring a 17pt text field in a 20pt row lands on
1.5. On a 2x display that is three whole device pixels and renders crisply; on a 1x display it is half a pixel and the text renders visibly blurred. Asking the view to align the rect covers both without special-casing either, and a test pins it so a later change cannot quietly put the subject back off the grid.Test plan
PBGitRevisionCellLayoutTests, all of which fail before this change: the subject was at midY 9 against a row centre of 10, and 7 on a row with no graph line.