Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions kilo.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,14 @@ void editorRefreshScreen(void) {
abFree(&ab);
}

/* This function clear the whole screen using VT100 escape characters */
void editorClearScreen(void) {
struct abuf ab = ABUF_INIT;
abAppend(&ab,"\x1b[J", E.numrows);
write(STDOUT_FILENO,ab.b,ab.len);
abFree(&ab);
}

/* Set an editor status message for the second line of the status, at the
* end of the screen. */
void editorSetStatusMessage(const char *fmt, ...) {
Expand Down Expand Up @@ -1207,6 +1215,7 @@ void editorProcessKeypress(int fd) {
quit_times--;
return;
}
editorClearScreen();
exit(0);
break;
case CTRL_S: /* Ctrl-s */
Expand Down