diff --git a/kilo.c b/kilo.c index 0e28297..776344d 100644 --- a/kilo.c +++ b/kilo.c @@ -64,8 +64,9 @@ char editorReadKey() { int getWindowSize(int *rows, int *cols) { struct winsize ws; - if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) { - return -1; + if (1 || ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) { + if (write(STDOUT_FILENO, "\x1b[999C\x1b[999B", 12) != 12) return -1; + editorReadKey(); } else { *cols = ws.ws_col; *rows = ws.ws_row;