summaryrefslogtreecommitdiff
path: root/src/gmdocument.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-04 08:12:21 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-04 08:12:21 +0300
commit3e22cb42d56aec3075c3ee77f5ff4fca2ab41813 (patch)
treea817e0e34c83f3a9982e6bf715039fceb5fce4c2 /src/gmdocument.c
parent4a86b0a6f05e07d8c13431b9d13e8c4d87841f76 (diff)
GmDocument: Fixed list item overdraw
Bullet icon backgrounds were overlapping the bullet text, causing them to be overdrawn.
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r--src/gmdocument.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 8361e77b..c086898f 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -314,22 +314,25 @@ static enum iGmDocumentTheme currentTheme_(void) {
314static void alignDecoration_GmRun_(iGmRun *run, iBool isCentered) { 314static void alignDecoration_GmRun_(iGmRun *run, iBool isCentered) {
315 const iRect visBounds = visualBounds_Text(run->font, run->text); 315 const iRect visBounds = visualBounds_Text(run->font, run->text);
316 const int visWidth = width_Rect(visBounds); 316 const int visWidth = width_Rect(visBounds);
317 int xAdjust = 0;
317 if (!isCentered) { 318 if (!isCentered) {
318 /* Keep the icon aligned to the left edge. */ 319 /* Keep the icon aligned to the left edge. */
319 run->visBounds.pos.x -= left_Rect(visBounds); 320 xAdjust -= left_Rect(visBounds);
320 if (visWidth > width_Rect(run->visBounds)) { 321 if (visWidth > width_Rect(run->visBounds)) {
321 /* ...unless it's a wide icon, in which case move it to the left. */ 322 /* ...unless it's a wide icon, in which case move it to the left. */
322 run->visBounds.pos.x -= visWidth - width_Rect(run->visBounds); 323 xAdjust -= visWidth - width_Rect(run->visBounds);
323 } 324 }
324 else if (visWidth < width_Rect(run->visBounds) * 3 / 4) { 325 else if (visWidth < width_Rect(run->visBounds) * 3 / 4) {
325 /* ...or a narrow icon, which needs to be centered but leave a gap. */ 326 /* ...or a narrow icon, which needs to be centered but leave a gap. */
326 run->visBounds.pos.x += (width_Rect(run->visBounds) * 3 / 4 - visWidth) / 2; 327 xAdjust += (width_Rect(run->visBounds) * 3 / 4 - visWidth) / 2;
327 } 328 }
328 } 329 }
329 else { 330 else {
330 /* Centered. */ 331 /* Centered. */
331 run->visBounds.pos.x += (width_Rect(run->visBounds) - visWidth) / 2; 332 xAdjust += (width_Rect(run->visBounds) - visWidth) / 2;
332 } 333 }
334 run->visBounds.pos.x += xAdjust;
335 run->visBounds.size.x -= xAdjust;
333} 336}
334 337
335static void doLayout_GmDocument_(iGmDocument *d) { 338static void doLayout_GmDocument_(iGmDocument *d) {