Simplify how we keep ATTRs under cursor
authorQuentin Rameau <quinq@fifth.space>
Tue, 4 Apr 2017 15:20:55 +0000 (17:20 +0200)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Tue, 4 Apr 2017 16:23:45 +0000 (18:23 +0200)
Thanks to tarug0 for the suggestion/patch.

x.c

diff --git a/x.c b/x.c
index b7339e9..fbfd350 100644 (file)
--- a/x.c
+++ b/x.c
@@ -1266,7 +1266,6 @@ xdrawcursor(void)
        Glyph g = {' ', ATTR_NULL, defaultbg, defaultcs}, og;
        int ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN);
        Color drawcol;
-       unsigned attr;
 
        LIMIT(oldx, 0, term.col-1);
        LIMIT(oldy, 0, term.row-1);
@@ -1286,8 +1285,8 @@ xdrawcursor(void)
        xdrawglyph(og, oldx, oldy);
 
        g.u = term.line[term.c.y][term.c.x].u;
-       attr = ATTR_BOLD | ATTR_ITALIC | ATTR_UNDERLINE | ATTR_STRUCK;
-       g.mode |= term.line[term.c.y][term.c.x].mode & attr;
+       g.mode |= term.line[term.c.y][term.c.x].mode &
+                 (ATTR_BOLD | ATTR_ITALIC | ATTR_UNDERLINE | ATTR_STRUCK);
 
        /*
         * Select the right color for the right mode.