sob

Simple output bar
git clone https://git.sinitax.com/codemadness/sob
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 32e1b3714fc4c84188673f668fca121b7c9e9256
parent 1ab0f13c8f9a8de7f3f0adb586cd1b22fc6f1023
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon, 13 Oct 2014 00:30:17 +0000

separate dirtylen from line so its not cleared

Diffstat:
Msob.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sob.c b/sob.c @@ -27,7 +27,6 @@ struct line { size_t utfpos; /* pos in characters */ size_t colpos; /* cursor position (in columns) */ size_t collen; /* total length (in columns) */ - size_t dirtylen; /* dirty length (in columns) */ }; static void cb_pipe_insert(const char *, size_t, size_t); @@ -86,6 +85,7 @@ static void utfuntilchar(size_t *, size_t *, int (*)(int), int); static struct termios ttystate, ttysave; static struct line line; +static size_t dirtylen; /* dirty length (in columns) */ static int cols, rows; static int isrunning = 1; static FILE * outfp = NULL; @@ -256,8 +256,8 @@ line_draw(void) fwrite(line.line, 1, line.bytesiz, outfp); /* replace dirty chars with ' ' */ - if(line.dirtylen > line.collen) { - for(i = line.collen; i < line.dirtylen; i++) + if(dirtylen > line.collen) { + for(i = line.collen; i < dirtylen; i++) fputc(' ', outfp); } line_cursor_move(line.colpos); @@ -773,7 +773,7 @@ handleinput(const unsigned char *input, size_t len) int ismatch = 0; char buf[BUFSIZ]; - line.dirtylen = line.collen; + dirtylen = line.collen; while(p < len && input[p] != '\0') { if(input[p] == 0x1b || iscntrl(input[p])) { ismatch = 0;