From 0a682b779e32da9ca7438e26a1f928fae6a3f1f7 Mon Sep 17 00:00:00 2001 From: jmug Date: Fri, 9 Oct 2026 17:36:48 -0700 Subject: [PATCH] feat: Exit with ctrl-q. --- kilo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kilo.c b/kilo.c index 2c825b0..9f3bb12 100644 --- a/kilo.c +++ b/kilo.c @@ -7,6 +7,10 @@ #include #include +/*** defines ***/ + +#define CTRL_KEY(k) ((k) & 0x1f) + /*** data ***/ struct termios orig_termios; @@ -57,7 +61,7 @@ int main() { } else { printf("%d ('%c')\r\n", c, c); } - if (c == 'q') + if (c == CTRL_KEY('q')) break; } return 0;