aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linenoise.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/linenoise.c b/linenoise.c
index 038756b..0612219 100644
--- a/linenoise.c
+++ b/linenoise.c
@@ -174,7 +174,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;
}