Skip to content

Commit

Permalink
https://viewsourcecode.org/snaptoken/kilo/03.rawInputAndOutput.html#r…
Browse files Browse the repository at this point in the history
…efactor-keyboard-input
  • Loading branch information
Gurrium committed Dec 16, 2022
1 parent 2fda903 commit 7ee418d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kilo.c
Expand Up @@ -7,6 +7,10 @@
#include <termios.h>
#include <unistd.h>

/*** difnes ***/

#define CTRL_KEY(k) ((k) & 0x1f)

/*** data ***/

struct termios orig_termios;
Expand Down Expand Up @@ -50,7 +54,7 @@ int main() {
} else {
printf("%d ('%c')\r\n", c, c);
}
if (c == 'q') break;
if (c == CTRL_KEY('q')) break;
}

return 0;
Expand Down

0 comments on commit 7ee418d

Please sign in to comment.