diff --git a/include/kilo.h b/include/kilo.h index bb68524..ea845b0 100644 --- a/include/kilo.h +++ b/include/kilo.h @@ -16,7 +16,6 @@ struct editor_state { int rx; int screenrows, screencols; int row_off, col_off; - bool running; struct EROW *rows; int n_rows; diff --git a/src/kilo.c b/src/kilo.c index 24162dd..8a4cb05 100644 --- a/src/kilo.c +++ b/src/kilo.c @@ -56,12 +56,11 @@ int main(int argc, char **argv) { if (argc >= 2) editor_open(argv[1]); - while (E.running) { + while (true) { editor_redraw_screen(); editor_process_key(); } - terminal_clear(); return 0; } @@ -82,7 +81,6 @@ void editor_init(void) { E.rx = 0; E.screenrows -= 2; E.row_off = E.col_off = 0; - E.running = true; E.rows = NULL; E.n_rows = 0; @@ -250,7 +248,8 @@ void editor_process_key(void) { break; case CTRL_KEY('Q'): - E.running = false; + terminal_clear(); + exit(0); break; } }