Skip to content

Commit

Permalink
ui: fix terminal UI on serial console
Browse files Browse the repository at this point in the history
Make sure we do not override the 80x24 default terminal size with zero
size as reported by an actual serial console.
  • Loading branch information
martanne committed Jun 7, 2020
1 parent c37f09e commit dd4c42f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ui-terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dd4c42f

Please sign in to comment.