improve handleinput: match escape (0x1b) and control chars (includes 127==del) … | |
git clone git://git.codemadness.org/sob | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b68741f2fe59eb350edf3dca744ad26800013893 | |
parent 5cfc09e6af0a5fec859dc9938210646ea97da167 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sun, 12 Oct 2014 22:07:39 +0000 | |
improve handleinput: match escape (0x1b) and control chars (includes 127==del) | |
Diffstat: | |
M sob.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, keyl… | |
+ if(len - p >= keylen && | |
+ memcmp(&input[p], keybinds[i].key, keylen) … | |
keybinds[i].func(); | |
p += keylen; | |
ismatch = 1; |