diff options
author | Ron Yorston <rmy@pobox.com> | 2016-08-03 15:50:00 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2016-08-03 15:50:00 +0100 |
commit | 1db2fafb1173038586cbb3d6673e1549a681c3fe (patch) | |
tree | 65277cae712930331e3d9bb3c62cab1e6a6c1cad | |
parent | 759188eae5651f1fbca45be310b0b9b46d876080 (diff) | |
download | busybox-w32-stty.tar.gz busybox-w32-stty.tar.bz2 busybox-w32-stty.zip |
stty: adjust console buffer when console size changesstty
The console buffer width is made to match the console width; the
buffer height must always be greater than or equal to the number of
rows in the console.
-rw-r--r-- | win32/winansi.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/win32/winansi.c b/win32/winansi.c index 757a3509d..aafd866a1 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -605,6 +605,12 @@ int winansi_set_terminal_width_height(struct winsize *win) | |||
605 | 605 | ||
606 | sbi.cbSize = sizeof(sbi); | 606 | sbi.cbSize = sizeof(sbi); |
607 | if ((ret=GetConsoleScreenBufferInfoEx(console, &sbi)) != 0) { | 607 | if ((ret=GetConsoleScreenBufferInfoEx(console, &sbi)) != 0) { |
608 | if (sbi.dwSize.X != win->ws_col) { | ||
609 | sbi.dwSize.X = win->ws_col; | ||
610 | } | ||
611 | if (sbi.dwSize.Y < win->ws_row) { | ||
612 | sbi.dwSize.Y = win->ws_row; | ||
613 | } | ||
608 | sbi.srWindow.Bottom = sbi.srWindow.Top + win->ws_row; | 614 | sbi.srWindow.Bottom = sbi.srWindow.Top + win->ws_row; |
609 | sbi.srWindow.Right = sbi.srWindow.Left + win->ws_col; | 615 | sbi.srWindow.Right = sbi.srWindow.Left + win->ws_col; |
610 | ret = SetConsoleScreenBufferInfoEx(console, &sbi); | 616 | ret = SetConsoleScreenBufferInfoEx(console, &sbi); |