rawcodes: display 'q' char as others
This commit is contained in:
parent
102bdebce7
commit
0bf782fe47
1 changed files with 7 additions and 3 deletions
10
rawcodes
10
rawcodes
|
|
@ -57,7 +57,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
enableRawMode();
|
enableRawMode();
|
||||||
|
|
||||||
printf("use 'q' to quit - 'q' is 113\r\n");
|
printf("use 'q' to quit\r\n");
|
||||||
|
|
||||||
if (argc >= 2 && strncmp("-m", argv[1], 2) == 0) {
|
if (argc >= 2 && strncmp("-m", argv[1], 2) == 0) {
|
||||||
printf("mouse gesture enabled\r\n");
|
printf("mouse gesture enabled\r\n");
|
||||||
|
|
@ -66,13 +66,17 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q') {
|
do {
|
||||||
|
if (read(STDIN_FILENO, &c, 1) != 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (iscntrl(c)) {
|
if (iscntrl(c)) {
|
||||||
printf("%d\r\n", c);
|
printf("%d\r\n", c);
|
||||||
} else {
|
} else {
|
||||||
printf("%d ('%c')\r\n", c, c);
|
printf("%d ('%c')\r\n", c, c);
|
||||||
}
|
}
|
||||||
}
|
} while (c != 'q');
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue