Archived
1
Fork 0

Remove the 'running' variable

This commit is contained in:
Hadeed 2023-09-01 07:48:37 +05:00
parent cbec00f522
commit f1a73ec874
2 changed files with 3 additions and 5 deletions

View file

@ -16,7 +16,6 @@ struct editor_state {
int rx; int rx;
int screenrows, screencols; int screenrows, screencols;
int row_off, col_off; int row_off, col_off;
bool running;
struct EROW *rows; struct EROW *rows;
int n_rows; int n_rows;

View file

@ -56,12 +56,11 @@ int main(int argc, char **argv) {
if (argc >= 2) if (argc >= 2)
editor_open(argv[1]); editor_open(argv[1]);
while (E.running) { while (true) {
editor_redraw_screen(); editor_redraw_screen();
editor_process_key(); editor_process_key();
} }
terminal_clear();
return 0; return 0;
} }
@ -82,7 +81,6 @@ void editor_init(void) {
E.rx = 0; E.rx = 0;
E.screenrows -= 2; E.screenrows -= 2;
E.row_off = E.col_off = 0; E.row_off = E.col_off = 0;
E.running = true;
E.rows = NULL; E.rows = NULL;
E.n_rows = 0; E.n_rows = 0;
@ -250,7 +248,8 @@ void editor_process_key(void) {
break; break;
case CTRL_KEY('Q'): case CTRL_KEY('Q'):
E.running = false; terminal_clear();
exit(0);
break; break;
} }
} }