X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=c0a4780aca6ee17d1933b9f3ff8c3d2101e4e782;hb=0851f2be2ab48ee3a67ef2287c09bd67622dcd8e;hp=f593302901444e60ead307bb058fb2c5c06de161;hpb=2bd6afd1c9eb341d9e2c5d89bc16bb7758691e1f;p=st.git diff --git a/st.c b/st.c index f593302..c0a4780 100644 --- a/st.c +++ b/st.c @@ -36,6 +36,7 @@ char *argv0; #define Draw XftDraw * #define Colour XftColor #define Colourmap Colormap +#define Rectangle XRectangle #if defined(__linux) #include @@ -1424,6 +1425,8 @@ 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++) { + if(selected(x, y)) + selclear(NULL); term.line[y][x] = term.c.attr; memcpy(term.line[y][x].c, " ", 2); } @@ -2764,6 +2767,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { FcCharSet *fccharset; Colour *fg, *bg, *temp, revfg, revbg; XRenderColor colfg, colbg; + Rectangle r; frcflags = FRC_NORMAL; @@ -2852,6 +2856,13 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { /* Clean up the region we want to draw to. */ XftDrawRect(xw.draw, bg, winx, winy, width, xw.ch); + /* Set the clip region because Xft is sometimes dirty. */ + r.x = 0; + r.y = 0; + r.height = xw.ch; + r.width = width; + XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1); + fcsets[0] = font->set; for(xp = winx; bytelen > 0;) { /* @@ -2885,6 +2896,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { (FcChar8 *)u8fs, u8fblen); xp += font->width * u8fl; + } break; } @@ -2969,6 +2981,9 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { XftDrawRect(xw.draw, fg, winx, winy + font->ascent + 1, width, 1); } + + /* Reset clip to none. */ + XftDrawSetClip(xw.draw, 0); } void @@ -3081,7 +3096,7 @@ drawregion(int x1, int y1, int x2, int y2) { ic = ib = ox = 0; for(x = x1; x < x2; x++) { new = term.line[y][x]; - if(ena_sel && *(new.c) && selected(x, y)) + if(ena_sel && selected(x, y)) new.mode ^= ATTR_REVERSE; if(ib > 0 && (ATTRCMP(base, new) || ib >= DRAW_BUF_SIZ-UTF_SIZ)) {