aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-16 19:39:45 +0200
committerDanilo M. <danix@danix.xyz>2026-09-16 19:39:45 +0200
commit9c9be25bdb0b2ec48e3078fe5e119b3d0f56631c (patch)
tree005c6b7d2f444b3e49eae38c35b0326ec89fa424 /widgets
parent7ded492aef4f03c7eb5e1b554f52fcfdaed709d5 (diff)
downloadconky-theme-udt-9c9be25bdb0b2ec48e3078fe5e119b3d0f56631c.tar.gz
conky-theme-udt-9c9be25bdb0b2ec48e3078fe5e119b3d0f56631c.zip
fix: step text cursors by advance, not ink width
The date rendered as "16 /SEP /2026", each slash jammed against the next glyph. measure() returns the ink width, which ignores leading and trailing spaces because a space carries no ink, and clock.lua was using it to advance a cursor. Measured: " / " covers 6px of ink but advances 14px, so every separator lost 8px. Splits the two uses that were conflated in one function. measure() is for centring and right-aligning, where ink width is what you want; advance() returns x_advance and is for laying out runs of text left to right. The clock's date now uses advance() and reads "16 / SEP / 2026" with even gaps, verified by screenshot. Worth the split rather than changing measure() in place: text_right is a correct caller of the ink width, so one function cannot serve both and silently returning the advance would have broken alignment instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'widgets')
-rw-r--r--widgets/clock.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/widgets/clock.lua b/widgets/clock.lua
index 10f1dd8..978715e 100644
--- a/widgets/clock.lua
+++ b/widgets/clock.lua
@@ -49,7 +49,8 @@ function M.draw(cr, rect, colors)
for _, p in ipairs(parts) do
card.rgba(cr, p[2])
card.text(cr, dx, dy, p[1])
- dx = dx + card.measure(cr, p[1])
+ -- advance(), not measure(): the ink width of ' / ' omits its spaces.
+ dx = dx + card.advance(cr, p[1])
end
end