Repository navigation
Center bar labels on the ink their figures paint - #17914
serhiivinichuk wants to merge 3 commits into
Conversation
[Medium impact] The PR appears safe to merge, with the existing non-blocking caption-test concern still open. Findings
SummaryUpdates
Reviews (5) · Last reviewed commit: "Keep bar label centering covered without..." · Reviewed by Greptile |
|
Checked #17878 for overlap, since it works on the same row. It corrects Measured on this machine with #17878 applied on top of
That is what #17878 reports itself — with JetBrainsMono Nerd Font the same icons measure the same before and after, except the weather icon — so on this font it moves no icon and leaves the label where it was. They are complementary rather than overlapping: on the Nerd Font Mono variants #17878 does move icons (11.5–12.5 → 13.0), which would leave this label further off until a label-side fix lands. |
7fdc642 to
411301d
Compare
411301d to
97ccdca
Compare
|
GPT-6 in Codex (effort not exposed) read the diff, discussion, and #17902 and classified this as a bug fix. The second classifier, deepseek-v4p1-flash (effort not recorded), returned no usable classification, so classification remains unsettled. No tests ran and no code changed; this is waiting on the maintainer to resolve classification before verification continues. |
|
Classification now agrees on No tests ran and no code changed in this session. The configured Opus 5.5 High comparison review terminated before returning a result, although the subsequent reviewer availability check succeeded. No second code review completed, so the choice between these competing fixes remains with the maintainer. This pull request remains open. |
Bar geometry test removed upstream with the test suite rework, so the branch keeps only the WidgetButton change.
Upstream removed bar-icon-geometry-test.sh with the test suite rework, so measure the label on its own: digits center on their ink, and the offset follows the label when its font changes.
| return | ||
| } | ||
| var center = inkCenter(button, label) | ||
| if (Math.abs(center - button.height / 2) > 0.5) { |
There was a problem hiding this comment.
The reported old position, 12.59375 against a middle of 13, differs by only 0.40625, so it passes this 0.5 threshold. The caption check therefore accepts the misalignment this PR fixes.
AGENTS.md requires a regression test to fail without the fix. Before merging, tighten the figure check to the stated 0.05 tolerance and check that reverting the offset makes the caption check fail.
File Used: AGENTS.md (source)
|
Closing in favour of #19373, which puts the figures on the bar's middle exactly where this branch only halves the error. Measured the production
The bug is still there on
The 0.05 tolerance the review asks for cannot pass without changing the placement, which is what #19373 does (label placed by One thing worth keeping: #19904 deleted |
What changes
Fixes #17902.
WidgetButtoncentered a label's figures by the font's ascent and descent:That holds only when the text item's height is exactly ascent plus descent. Qt rounds the line box up, so at the 10 px caption size the box is 14 px against 13.19 px of metrics, and the figures land 0.4 px above the middle of the box — a whole row once rasterized. At 12 px the same error is 0.09 px, which is why #14234 lined up the clock and the workspace numbers and left the caption-size keyboard layout label (
EN,UA) a row above the icons beside it.The offset now centers the figure ink where it actually paints: up from the baseline, which is the metrics' ascent for a single line, by the digit's ink box from the
FontMetricsthe file already had. Ascent and height are read in the same expression so the offset follows the label when its font changes — atightBoundingRectcall on its own is not a dependency QML tracks, so reading only the label'sbaselineOffsetleft the ink stale across a font change (which the test below caught once the caption size moves mid-file).Nothing else changes:
centerFigures: false(the menu logo), vertical bars and multi-line labels keep the plain line-box centering.BarIconButtonrepeats the old expression for the labels beside panel and status icons (battery percentages, tray counts). Left out here: those paint at 13 px and 11 px in their own row, and this is the reported bar widget, so they want a before/after of their own.Verification
test/shell.d/bar-icon-geometry-test.shgains the label side of the same geometry: theWidgetButtonat the caption size (what the keyboard layout indicator draws) and at 15 px must center their digit ink on their own line box, within 0.05 px, and acenterFigures: falselabel must keep the plain line-box centering. Onquattroit fails withcaption label figure ink centers at 12.59, its line box at 13; with the change it passes, including through the two theme rescales the file already runs../test/shell: 421 files, 9 of which report skips for things this machine lacks (battery, Kitty, some locales, anomarchy-pkgscheckout). A handful of timing-sensitive files fail under the pool (camera, shell-idle-spawn, channel-switch, screenrecording-process, ssh-reconnect, t3code-install); re-run one at a time, onlycamera-test.shstill fails, onWirePlumber waits until the seat's camera opens, which it also does on the base branch — this desktop has no camera. The rest pass alone.kb_layout = "us,ua"so the widget draws its label: the label moves from ink rows 8–15 to 9–16 and lands on the row line of the icons beside it (12.5, the bar's middle being 13). The two captures differ in a single 10×9 region — the label itself — so the clock and the workspace numbers do not move.Screenshots
Live bar, this branch's shell before and after the change, 4×. The red line marks the bar's middle row: