]> git.lizzy.rs Git - linenoise.git/blobdiff - linenoise.c
Fix line editing when columns unavailable
[linenoise.git] / linenoise.c
index 4a62b482cf516caedb4aa4a05083f5ab47850e0e..9c84a129e380dc0233cbf68a4ce6a08bf3ae8ab2 100644 (file)
@@ -197,7 +197,7 @@ static void linenoiseAtExit(void) {
 static int getColumns(void) {
     struct winsize ws;
 
-    if (ioctl(1, TIOCGWINSZ, &ws) == -1) return 80;
+    if (ioctl(1, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) return 80;
     return ws.ws_col;
 }