fix resizewin for serial consoles - sfeed_curses - sfeed curses UI (now part of… | |
git clone git://git.codemadness.org/sfeed_curses | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit cb62fb68ea42d7ca3f52fee947077a0f35d8000a | |
parent 65449180719dd2c4d27f7370695b9e4eee9e5b72 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sun, 21 Mar 2021 01:46:03 +0100 | |
fix resizewin for serial consoles | |
winsz.ws_col or winsz.ws_row can be 0. | |
Diffstat: | |
M sfeed_curses.c | 9 ++++++--- | |
1 file changed, 6 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/sfeed_curses.c b/sfeed_curses.c | |
@@ -624,10 +624,13 @@ void | |
resizewin(void) | |
{ | |
struct winsize winsz; | |
+ int width, height; | |
- if (ioctl(1, TIOCGWINSZ, &winsz) != -1 && | |
- winsz.ws_col > 0 && winsz.ws_row > 0) | |
- win_update(&win, winsz.ws_col, winsz.ws_row); | |
+ if (ioctl(1, TIOCGWINSZ, &winsz) != -1) { | |
+ width = winsz.ws_col > 0 ? winsz.ws_col : 80; | |
+ height = winsz.ws_row > 0 ? winsz.ws_row : 24; | |
+ win_update(&win, width, height); | |
+ } | |
if (win.dirty) | |
alldirty(); | |
} |