sob

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

commit b68741f2fe59eb350edf3dca744ad26800013893
parent 5cfc09e6af0a5fec859dc9938210646ea97da167
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 12 Oct 2014 22:07:39 +0000

improve handleinput: match escape (0x1b) and control chars (includes 127==del)

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

diff --git a/sob.c b/sob.c @@ -777,12 +777,12 @@ handleinput(const unsigned char *input, size_t len) line.dirtylen = line.collen; while(p < len && input[p] != '\0') { - if(input[p] <= 0x1b) { + if(input[p] == 0x1b || iscntrl(input[p])) { ismatch = 0; for(i = 0; i < LEN(keybinds); i++) { keylen = strlen((char*)keybinds[i].key); - if(strncmp((const char*)&input[p], - (const char *)keybinds[i].key, keylen) == 0) { + if(len - p >= keylen && + memcmp(&input[p], keybinds[i].key, keylen) == 0) { keybinds[i].func(); p += keylen; ismatch = 1;