diff options
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | draw.c | 8 |
2 files changed, 9 insertions, 1 deletions
@@ -443,7 +443,7 @@ Other: other already drawn input. Example: - ^^ib(1)^^fg(red)^^ro(100x15)^^p(-98)^^fg(blue)^^r(20x10)^^fg(orange)^^p(3)^^r(40x10)^^p(4)^^fg(darkgreen)^^co(12)^^p(2)^^c(10) + ^ib(1)^fg(red)^ro(100x15)^p(-98)^fg(blue)^r(20x10)^fg(orange)^p(3)^r(40x10)^p(4)^fg(darkgreen)^co(12)^p(2)^c(10) @@ -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; |