From 025cc312b0c5a049bc01b0ea37851f40e9d9ba34 Mon Sep 17 00:00:00 2001 From: Kun Date: Tue, 12 Jul 2016 22:33:17 +0000 Subject: [PATCH 1/2] clear screen at exit using escape sequence --- kilo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kilo.c b/kilo.c index 9490a77..8129c26 100644 --- a/kilo.c +++ b/kilo.c @@ -1182,6 +1182,7 @@ void editorProcessKeypress(int fd) { quit_times--; return; } + printf("\033[2J\033[1;1H"); exit(0); break; case CTRL_S: /* Ctrl-s */ From fbebd7c331f3446fbcbfc62215b547cac90c88e0 Mon Sep 17 00:00:00 2001 From: Kun Date: Fri, 15 Jul 2016 17:38:27 +0000 Subject: [PATCH 2/2] move clear screen code to exit handler --- kilo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kilo.c b/kilo.c index 8129c26..c714273 100644 --- a/kilo.c +++ b/kilo.c @@ -198,6 +198,7 @@ void disableRawMode(int fd) { /* Called at exit to avoid remaining in raw mode. */ void editorAtExit(void) { disableRawMode(STDIN_FILENO); + printf("\033[2J\033[1;1H"); } /* Raw mode: 1960 magic shit. */ @@ -1182,7 +1183,6 @@ void editorProcessKeypress(int fd) { quit_times--; return; } - printf("\033[2J\033[1;1H"); exit(0); break; case CTRL_S: /* Ctrl-s */