diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2020-06-07 12:14:36 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2020-06-07 12:17:25 +0200 |
| commit | dd4c42fa3dd821733ca41851e5e699b3cdf57818 (patch) | |
| tree | 1719dee63dfd6025552c1f39465ef6de331839e8 | |
| parent | c37f09ed99baae4ae42381ebfc608003942528b3 (diff) | |
| download | vis-dd4c42fa3dd821733ca41851e5e699b3cdf57818.tar.gz vis-dd4c42fa3dd821733ca41851e5e699b3cdf57818.tar.xz | |
ui: fix terminal UI on serial console
Make sure we do not override the 80x24 default terminal size with zero
size as reported by an actual serial console.
| -rw-r--r-- | ui-terminal.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ui-terminal.c b/ui-terminal.c index c862f63..9cdfd7e 100644 --- a/ui-terminal.c +++ b/ui-terminal.c @@ -371,13 +371,13 @@ static void ui_resize(Ui *ui) { int width = 80, height = 24; if (ioctl(STDERR_FILENO, TIOCGWINSZ, &ws) != -1) { - width = ws.ws_col; - height = ws.ws_row; + if (ws.ws_col > 0) + width = ws.ws_col; + if (ws.ws_row > 0) + height = ws.ws_row; } - width = MAX(width, 1); width = MIN(width, MAX_WIDTH); - height = MAX(height, 1); height = MIN(height, MAX_HEIGHT); if (!ui_term_backend_resize(tui, width, height)) return; |
