vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 5f1c65450b22d9f89dd4c80186cb115adaf991fb
parent 37f892cadc54ec42697616803b701bbd6d33c72b
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun,  7 Jun 2020 12:14:36 +0200

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.

Diffstat:
Mui-terminal.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 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;