From c69c44292feb8c692ba3e3c9e661ff49a784903d Mon Sep 17 00:00:00 2001 From: Jens Wirth Date: Mon, 11 Jul 2016 05:26:00 +0200 Subject: [PATCH] move cursor below editor before quitting --- kilo.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kilo.c b/kilo.c index 9490a77..c22f934 100644 --- a/kilo.c +++ b/kilo.c @@ -1181,8 +1181,16 @@ void editorProcessKeypress(int fd) { "Press Ctrl-Q %d more times to quit.", quit_times); quit_times--; return; + } else { + /* move cursor below editor before quitting */ + char buf[32]; + struct abuf ab = ABUF_INIT; + snprintf(buf,sizeof(buf),"\x1b[%d;%dH\r\n",E.screenrows+2,1); //numrows + abAppend(&ab,buf,strlen(buf)); + write(STDOUT_FILENO,ab.b,ab.len); + abFree(&ab); + exit(0); } - exit(0); break; case CTRL_S: /* Ctrl-s */ editorSave();