From b2e35c58a46ef50d08cac44453ac969840c6ff5e Mon Sep 17 00:00:00 2001 From: gurrium Date: Tue, 3 Jan 2023 20:26:02 +0900 Subject: [PATCH] next: https://viewsourcecode.org/snaptoken/kilo/04.aTextViewer.html#multiple-lines --- kilo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kilo.c b/kilo.c index d1f663d..bf63252 100644 --- a/kilo.c +++ b/kilo.c @@ -1,5 +1,9 @@ /*** includes ***/ +#define _DEFAULT_SOURCE +#define _BSD_SOURCE +#define _GNU_SOURCE + #include #include #include @@ -285,7 +289,7 @@ void editorDrawRows(struct abuf *ab) { int y; for (y = 0; y < E.screenrows; y++) { if (y >= E.numrows) { - if (y == E.screenrows / 3) { + if (E.numrows == 0 && y == E.screenrows / 3) { char welcome[80]; int welcomelen = snprintf(welcome, sizeof(welcome), "Kilo editor -- version %s", KILO_VERSION);