summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux2014-08-26 20:22:24 -0400
committerQuentin Carbonneaux2014-08-26 20:22:24 -0400
commitc47ba5be4ee69616b19adf0a2766f6a7466ee340 (patch)
treebb5a86af6d412fb1ee4d847784c7084755a7fbc7
parent2e3f55654853bdc6c9a48a9e3670461ebbb7237c (diff)
clean drawing code
-rw-r--r--win.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/win.c b/win.c
index 3f2efe8..af79446 100644
--- a/win.c
+++ b/win.c
@@ -452,13 +452,16 @@ draw(W *w, GColor bg)
flushfrag(&f, w, x, y, sel);
next = &w->l[1];
- for (c=w->l[0]; c<w->l[w->nl]; c++) {
+ for (c=w->l[0];; c++) {
if (c >= *next) {
assert(c == *next);
x = g->hmargin;
y += font.height;
next++;
+ f.w = fwidth;
flushfrag(&f, w, x, y, sel);
+ if (next - w->l > w->nl)
+ break;
}
if (sel ^ (s0 <= c && c < s1)) {
@@ -479,13 +482,10 @@ draw(W *w, GColor bg)
if (r == '\t') {
pushfrag(&f, ' ', rw);
flushfrag(&f, w, x, y, sel);
- } else if (r == '\n')
- f.w = w->gr.w - g->hmargin;
- else
+ } else if (r != '\n')
pushfrag(&f, r, rw);
}
- flushfrag(&f, w, 0, 0, sel);
if (cw != 0)
g->drawrect(&w->gr, cx, cy, cw, font.height, GXBlack);
g->decorate(&w->gr, w->eb->path && w->eb->frev != eb_revision(w->eb), GGray);