aboutsummaryrefslogtreecommitdiffstats
path: root/draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'draw.c')
-rw-r--r--draw.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/draw.c b/draw.c
index 4440084..b3f9177 100644
--- a/draw.c
+++ b/draw.c
@@ -364,9 +364,13 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
case recto:
get_rect_vals(tval, &rectw, &recth);
+ if (!rectw) break;
+
rectw = rectw+px > dzen.w ? dzen.w-px : rectw;
recth = recth > dzen.line_height ? dzen.line_height-2 : recth-1;
recty = (dzen.line_height - recth)/2;
+ /* prevent from stairs effect when rounding recty */
+ if (!((dzen.line_height - recth) % 2)) recty--;
setcolor(&pm, px, rectw, lastfg, lastbg, reverse, nobg);
XDrawRectangle(dzen.dpy, pm, dzen.tgc, px, (int)recty, rectw-1, recth);
px += rectw;
@@ -501,9 +505,13 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
case recto:
get_rect_vals(tval, &rectw, &recth);
+ if (!rectw) break;
+
rectw = rectw+px > dzen.w ? dzen.w-px : rectw;
recth = recth > dzen.line_height ? dzen.line_height-2 : recth-1;
recty = (dzen.line_height - recth)/2;
+ /* prevent from stairs effect when rounding recty */
+ if (!((dzen.line_height - recth) % 2)) recty--;
setcolor(&pm, px, rectw, lastfg, lastbg, reverse, nobg);
XDrawRectangle(dzen.dpy, pm, dzen.tgc, px, (int)recty, rectw-1, recth);
px += rectw;