From c034f9ded7a2b827f7f09fed8a0c531fd96a11b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 12 Aug 2015 19:14:43 +0200 Subject: ui: query terminal size on stderr We always draw the editor user interface to stderr in order to allow usage as a filter e.g. $ echo Hello | vis - | grep World > out hence stdin might be redirected and we should always read the terminal size from stderr. Closes #66 --- ui-curses.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ui-curses.c') diff --git a/ui-curses.c b/ui-curses.c index 569b2ca..30e8c94 100644 --- a/ui-curses.c +++ b/ui-curses.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -300,7 +301,7 @@ static void ui_resize(Ui *ui) { struct winsize ws; int width, height; - if (ioctl(0, TIOCGWINSZ, &ws) == -1) { + if (ioctl(STDERR_FILENO, TIOCGWINSZ, &ws) == -1) { getmaxyx(stdscr, height, width); } else { width = ws.ws_col; -- cgit v1.2.3