dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 113059f57c5d44c562cea90831aaf10150710b9f
parent 73dded45b6cf934864db459a685cc1bed9ee05a7
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Wed,  5 Dec 2012 15:29:39 +0100

Make terminal size detection a bit more robust

The ioctl fails if stdin is not a terminal (which is the case
with input redirection for test purposes). Before the workspace
variables waw, wah would remain zero during the whole runtime.

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
dvtm.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dvtm.c b/dvtm.c @@ -540,11 +540,12 @@ static void resize_screen() { struct winsize ws; - if (ioctl(0, TIOCGWINSZ, &ws) == -1) - return; - - screen.w = ws.ws_col; - screen.h = ws.ws_row; + if (ioctl(0, TIOCGWINSZ, &ws) == -1) { + getmaxyx(stdscr, screen.h, screen.w); + } else { + screen.w = ws.ws_col; + screen.h = ws.ws_row; + } debug("resize_screen(), w: %d h: %d\n", screen.w, screen.h); @@ -632,7 +633,6 @@ setup() { mouse_setup(); raw(); vt_init(); - getmaxyx(stdscr, screen.h, screen.w); resize_screen(); signal(SIGWINCH, sigwinch_handler); signal(SIGCHLD, sigchld_handler);