diff options
author | Kent Overstreet <koverstreet@google.com> | 2013-03-23 17:58:50 -0700 |
---|---|---|
committer | Kent Overstreet <koverstreet@google.com> | 2013-04-23 16:37:36 -0700 |
commit | 77c8d0b761b09239d20b171b633f18476f4ed955 (patch) | |
tree | 96f6bce2c35a8c8b227ff5b9b07ac4bdece2c4b1 | |
parent | 25b10e39b63c4fd7583fee117e84ff46dd577091 (diff) |
kill st_glyph->set
-rw-r--r-- | st.c | 47 | ||||
-rw-r--r-- | term.c | 14 | ||||
-rw-r--r-- | term.h | 1 |
3 files changed, 17 insertions, 45 deletions
@@ -320,17 +320,6 @@ static void selrequest(struct st_window *xw, XEvent *e) /* Screen drawing code */ -static void xtermclear(struct st_window *xw, - int col1, int row1, int col2, int row2) -{ - XftDrawRect(xw->draw, - &xw->col[xw->term.reverse ? defaultfg : defaultbg], - borderpx + col1 * xw->charsize.x, - borderpx + row1 * xw->charsize.y, - (col2 - col1 + 1) * xw->charsize.x, - (row2 - row1 + 1) * xw->charsize.y); -} - static void xclear(struct st_window *xw, XftColor *color, struct coord pos, unsigned charlen) { @@ -522,7 +511,6 @@ retry: if (!found) { xfont = find_font(xw, font, ucs, frcflags); - if (!xfont) { if (ucs != 0xFFFD) ucs = 0xFFFD; @@ -551,7 +539,7 @@ retry: static void xdrawcursor(struct st_window *xw) { - struct st_glyph g, *p, *old; + struct st_glyph g, *p; g.c = ' '; g.cmp = 0; @@ -563,18 +551,12 @@ static void xdrawcursor(struct st_window *xw) p = term_pos(&xw->term, xw->term.c.pos); - if (p->set) - g.c = p->c; + g.c = p->c; /* remove the old cursor */ - old = term_pos(&xw->term, xw->term.oldcursor); - if (old->set) { - xdraw_glyphs(xw, xw->term.oldcursor, *old, old, 1); - } else { - xtermclear(xw, - xw->term.oldcursor.x, xw->term.oldcursor.y, - xw->term.oldcursor.x, xw->term.oldcursor.y); - } + xdraw_glyphs(xw, xw->term.oldcursor, + *term_pos(&xw->term, xw->term.oldcursor), + term_pos(&xw->term, xw->term.oldcursor), 1); /* draw the new one */ if (!xw->term.hide) { @@ -610,7 +592,6 @@ static void drawregion(struct st_window *xw, if (!xw->term.dirty[y]) continue; - xtermclear(xw, 0, y, xw->term.size.x, y); xw->term.dirty[y] = 0; base = xw->term.line[y][0]; ic = ib = ox = 0; @@ -623,14 +604,12 @@ static void drawregion(struct st_window *xw, base, &xw->term.line[y][ox], ic); ic = 0; } - if (new.set) { - if (ic == 0) { - ox = x; - base = new; - } - - ++ic; + if (ic == 0) { + ox = x; + base = new; } + + ++ic; } if (ic > 0) xdraw_glyphs(xw, (struct coord) {ox, y}, @@ -905,13 +884,11 @@ static void brelease(struct st_window *xw, XEvent *e) /* double click to select word */ sel->bx = sel->ex; while (sel->bx > 0 && - term->line[sel->ey][sel->bx - 1].set && - term->line[sel->ey][sel->bx - 1].c != ' ') + isalpha(term->line[sel->ey][sel->bx - 1].c)) sel->bx--; sel->b.x = sel->bx; while (sel->ex < term->size.x - 1 && - term->line[sel->ey][sel->ex + 1].set && - term->line[sel->ey][sel->ex + 1].c != ' ') + isalpha(term->line[sel->ey][sel->ex + 1].c)) sel->ex++; sel->e.x = sel->ex; sel->b.y = sel->e.y = sel->ey; @@ -104,7 +104,7 @@ void term_selcopy(struct st_term *term) gp = &term->line[y][0]; last = gp + term->size.y; - while (--last >= gp && !last->set) + while (--last >= gp && !last->c) /* nothing */ ; for (x = 0; gp <= last; x++, ++gp) { @@ -114,7 +114,7 @@ void term_selcopy(struct st_term *term) is_selected = 1; } - if (gp->set) + if (gp->c) ptr += FcUcs4ToUtf8(gp->c, ptr); else *(ptr++) = ' '; @@ -199,11 +199,8 @@ static void __tclearline(struct st_term *term, unsigned y, for (g = &term->line[y][start]; g < &term->line[y][end]; - g++) { + g++) *g = term->c.attr; - g->c = 0; - g->set = 1; - } } static void tclearline(struct st_term *term, unsigned start, unsigned end) @@ -406,7 +403,6 @@ static void tsetchar(struct st_term *term, unsigned c, struct coord pos) term->dirty[pos.y] = 1; *g = term->c.attr; g->c = c; - g->set = 1; } static void tdeletechar(struct st_term *term, int n) @@ -1346,8 +1342,8 @@ void term_resize(struct st_term *term, struct coord size) term->line[i] = xrealloc(term->line[i], size.x * sizeof(struct st_glyph)); term->alt[i] = xrealloc(term->alt[i], size.x * sizeof(struct st_glyph)); for (x = mincol; x < size.x ; x++) { - term->line[i][x].set = 0; - term->alt[i][x].set = 0; + term->line[i][x] = term->c.attr; + term->alt[i][x] = term->c.attr; } } @@ -96,7 +96,6 @@ struct st_glyph { unsigned gfx:1; unsigned italic:1; unsigned blink:1; - unsigned set:1; }; }; }; |