minicurses: do not use columns or rows when they are <= 0 - sfeed_curses - sfeed curses UI (now part of sfeed, development is in sfeed)
(HTM) git clone git://git.codemadness.org/sfeed_curses
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 1498a23eb6d0ba3841c9e57045c25a335f5e4e9b
(DIR) parent 28795e476d1775e0cf96a5dd8444e200e5197152
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 21 Dec 2020 14:03:07 +0100
minicurses: do not use columns or rows when they are <= 0
Instead use the default sizes.
The ioctl can return success but not have the sizes set.
Noticed on qemu -nographic via a console.
Diffstat:
M minicurses.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/minicurses.h b/minicurses.h
@@ -24,8 +24,10 @@ setupterm(char *term, int fildes, int *errret)
if (ioctl(fildes, TIOCGWINSZ, &winsz) == -1)
return -1; /* ERR */
- columns = winsz.ws_col;
- lines = winsz.ws_row;
+ if (winsz.ws_col > 0)
+ columns = winsz.ws_col;
+ if (winsz.ws_row > 0)
+ lines = winsz.ws_row;
return 0; /* OK */
}