[hackers] [st] Fix selecting clearing and BCE || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 24 Apr 2013 21:19:51 +0200

commit 048c54fd5b275ac54d7819020485b77e99fcc469
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Tue Apr 23 20:34:52 2013 +0200

    Fix selecting clearing and BCE
    
    The commit b78c5085f72 changed the st behaviour enabling BCE capability,
    that means erase regions using background color. Problem comes when you
    clear a region with a selection, because in this case the real mode of the
    Glyph is not the value of term.line[y][x], due in drawregion we had enabled
    the ATTR_REVERSE bit.
    
    Signed-off-by: Christoph Lohmann <20h_AT_r-36.net>

diff --git a/st.c b/st.c
index 7f53981..92854b4 100644
--- a/st.c
+++ b/st.c
_AT_@ -1410,7 +1410,7 @@ tsetchar(char *c, Glyph *attr, int x, int y) {
 
 void
 tclearregion(int x1, int y1, int x2, int y2) {
- int x, y, temp;
+ int x, y, temp, mask;
 
         if(x1 > x2)
                 temp = x1, x1 = x2, x2 = temp;
_AT_@ -1425,7 +1425,9 @@ tclearregion(int x1, int y1, int x2, int y2) {
         for(y = y1; y <= y2; y++) {
                 term.dirty[y] = 1;
                 for(x = x1; x <= x2; x++) {
+ mask = selected(x, y) ? ATTR_REVERSE : 0;
                         term.line[y][x] = term.c.attr;
+ term.line[y][x].mode ^= mask;
                         memcpy(term.line[y][x].c, " ", 2);
                 }
         }
Received on Wed Apr 24 2013 - 21:19:51 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 24 2013 - 21:24:10 CEST