[hackers] [st] Fixing a off-by-one error in the penultimate row drawing. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Sat, 22 Dec 2012 13:41:47 +0100

commit ac4c6da4ef9b05e2886c26272745effc4f975042
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Sat Dec 22 13:39:27 2012 +0100

    Fixing a off-by-one error in the penultimate row drawing.

diff --git a/st.c b/st.c
index aa72a43..d47bebc 100644
--- a/st.c
+++ b/st.c
_AT_@ -2248,7 +2248,7 @@ xtermclear(int col1, int row1, int col2, int row2) {
 void
 xclear(int x1, int y1, int x2, int y2) {
         XftDrawRect(xw.draw,
- &dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg],
+ &dc.col[IS_SET(MODE_REVERSE)? defaultfg : defaultbg],
                         x1, y1, x2-x1, y2-y1);
 }
 
_AT_@ -2515,8 +2515,11 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
                 }
         }
 
- if(base.mode & ATTR_REVERSE)
- temp = fg, fg = bg, bg = temp;
+ if(base.mode & ATTR_REVERSE) {
+ temp = fg;
+ fg = bg;
+ bg = temp;
+ }
 
         XftTextExtentsUtf8(xw.dpy, font->set, (FcChar8 *)s, bytelen,
                         &extents);
_AT_@ -2525,11 +2528,11 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
         /* Intelligent cleaning up of the borders. */
         if(x == 0) {
                 xclear(0, (y == 0)? 0 : winy, borderpx,
- winy + xw.ch + ((y == term.row-1)? xw.h : 0));
+ winy + xw.ch + ((y >= term.row-1)? xw.h : 0));
         }
- if(x + charlen >= term.col-1) {
+ if(x + charlen >= term.col)
                 xclear(winx + width, (y == 0)? 0 : winy, xw.w,
- ((y == term.row-1)? xw.h : (winy + xw.ch)));
+ ((y >= term.row-1)? xw.h : (winy + xw.ch)));
         }
         if(y == 0)
                 xclear(winx, 0, winx + width, borderpx);
Received on Sat Dec 22 2012 - 13:41:47 CET

This archive was generated by hypermail 2.3.0 : Sat Dec 22 2012 - 13:48:06 CET