\e string escape is not portable; use \033

This commit is contained in:
Paul LeoNerd Evans 2012-01-18 16:36:10 +00:00
parent 3981920938
commit 6bc3f8a378
3 changed files with 5 additions and 5 deletions

4
demo.c
View File

@ -45,7 +45,7 @@ int main(int argc, char *argv[])
TermKeyKey key; TermKeyKey key;
if(mouse) if(mouse)
printf("\e[?%dhMouse mode active\n", mouse); printf("\033[?%dhMouse mode active\n", mouse);
while((ret = termkey_waitkey(tk, &key)) != TERMKEY_RES_EOF) { while((ret = termkey_waitkey(tk, &key)) != TERMKEY_RES_EOF) {
if(ret == TERMKEY_RES_KEY) { if(ret == TERMKEY_RES_KEY) {
@ -67,7 +67,7 @@ int main(int argc, char *argv[])
} }
if(mouse) if(mouse)
printf("\e[?%dlMouse mode deactivated\n", mouse); printf("\033[?%dlMouse mode deactivated\n", mouse);
termkey_destroy(tk); termkey_destroy(tk);
} }

View File

@ -41,7 +41,7 @@ int main(int argc, char *argv[])
is_int(key.code.number, 'a', "key.code.number after C-a"); is_int(key.code.number, 'a', "key.code.number after C-a");
is_int(key.modifiers, TERMKEY_KEYMOD_CTRL, "key.modifiers after C-a"); is_int(key.modifiers, TERMKEY_KEYMOD_CTRL, "key.modifiers after C-a");
termkey_push_bytes(tk, "\eOA", 3); termkey_push_bytes(tk, "\033OA", 3);
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after Up"); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after Up");
@ -49,7 +49,7 @@ int main(int argc, char *argv[])
is_int(key.code.sym, TERMKEY_SYM_UP, "key.code.sym after Up"); is_int(key.code.sym, TERMKEY_SYM_UP, "key.code.sym after Up");
is_int(key.modifiers, 0, "key.modifiers after Up"); is_int(key.modifiers, 0, "key.modifiers after Up");
is_int(termkey_push_bytes(tk, "\eO", 2), 2, "push_bytes returns 2"); is_int(termkey_push_bytes(tk, "\033O", 2), 2, "push_bytes returns 2");
is_int(termkey_get_buffer_remaining(tk), 254, "buffer free 254 after partial write"); is_int(termkey_get_buffer_remaining(tk), 254, "buffer free 254 after partial write");

View File

@ -42,7 +42,7 @@ int main(int argc, char *argv[])
is_int(termkey_getkey(tk, &key), TERMKEY_RES_NONE, "getkey yields RES_NONE a second time"); is_int(termkey_getkey(tk, &key), TERMKEY_RES_NONE, "getkey yields RES_NONE a second time");
write(fd[1], "\eO", 2); write(fd[1], "\033O", 2);
termkey_advisereadable(tk); termkey_advisereadable(tk);
is_int(termkey_get_buffer_remaining(tk), 254, "buffer free 254 after partial write"); is_int(termkey_get_buffer_remaining(tk), 254, "buffer free 254 after partial write");