commit 17ec5b5ac060760aef49177b642da4dc648a8349
parent 734b49a9b6bb6aefb5e354c4f48e46454065fc13
Author: Claudio Alessi <smoppy@gmail.com>
Date: Fri, 21 Oct 2022 18:10:51 +0200
When the buffer has no data still clean the screen.
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/circo.c b/circo.c
@@ -812,13 +812,14 @@ drawbuf(void) {
int x, y, c, i, nb, nx;
char *endp;
- if(!(cols && rows && sel->len))
+ if(!(cols && rows))
return;
+
x = rows - 2;
y = sel->nlines - x;
i = sel->line
? sel->lnoff
- : bufinfo(sel->data, sel->len, 1 + (sel->nlines > x ? y : 0), LineToOffset);
+ : sel->len ? bufinfo(sel->data, sel->len, 1 + (sel->nlines > x ? y : 0), LineToOffset) : 0;
x = 1;
y = 2;
@@ -1760,8 +1761,8 @@ main(int argc, char *argv[]) {
setup();
if(*logfile)
logp = fopen(logfile, "a");
- sel = status = newbuf("status");
setbuf(stdout, NULL);
+ sel = status = newbuf("status");
sel->need_redraw = REDRAW_ALL;
printf(CLEAR);
draw();