diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-05 22:28:08 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-05 22:39:36 -0700 |
commit | 6fc0e72cb3adda2151dbb643579b5c53bc940413 (patch) | |
tree | 290796afd561c0d524b9783dfeb10d4b67b6172e /src/kilo.c | |
parent | 6b8da095b1e14d0dad17e78513217abb4cfed8bf (diff) | |
download | teliva-6fc0e72cb3adda2151dbb643579b5c53bc940413.tar.gz |
utterly ghastly way to rerun script after edit
Diffstat (limited to 'src/kilo.c')
-rw-r--r-- | src/kilo.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/kilo.c b/src/kilo.c index f3b5665..174bdc3 100644 --- a/src/kilo.c +++ b/src/kilo.c @@ -1154,6 +1154,7 @@ void editorMoveCursor(int key) { /* Process events arriving from the standard input, which is, the user * is typing stuff on the terminal. */ #define KILO_QUIT_TIMES 3 +int Quit = 0; void editorProcessKeypress(int fd) { /* When the file is modified, requires Ctrl-q to be pressed N times * before actually quitting. */ @@ -1176,7 +1177,7 @@ void editorProcessKeypress(int fd) { quit_times--; return; } - exit(0); + Quit = 1; break; case CTRL_S: /* Ctrl-s */ editorSave(); @@ -1263,7 +1264,7 @@ void edit(char* filename) { enableRawMode(STDIN_FILENO); editorSetStatusMessage( "HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find"); - while(1) { + while(!Quit) { editorRefreshScreen(); editorProcessKeypress(STDIN_FILENO); } |