From 1e97709bd8270419c45d9d1fcc82ee18ae31b92f Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sat, 5 May 2018 11:31:31 +1000 Subject: [PATCH] Use output_screen size instead of current_term in term_scroll This fixes a regression in commmit 70ac43ce779dde926c43e01bf17ceab2e5108df7, where the original screen size would be used to scroll after the terminal had been resized. If the screen was shrunk, this caused display problems when running under GNU Screen. Using output_screen size means that it stands a better chance of working on non-default screens, too. --- source/term.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/term.c b/source/term.c index d769b95..d11c683 100644 --- a/source/term.c +++ b/source/term.c @@ -1509,8 +1509,8 @@ void term_scroll (int top, int bot, int n) char thing[128], final[128], start[128]; #ifdef __EMX__ pair[0] = ' '; pair[1] = 7; - if (n > 0) VioScrollUp(top, 0, bot, current_term->TI_cols, n, (PBYTE)&pair, (HVIO) vio_screen); - else if (n < 0) { n = -n; VioScrollDn(top, 0, bot, current_term->TI_cols, n, (PBYTE)&pair, (HVIO) vio_screen); } + if (n > 0) VioScrollUp(top, 0, bot, output_screen->co, n, (PBYTE)&pair, (HVIO) vio_screen); + else if (n < 0) { n = -n; VioScrollDn(top, 0, bot, output_screen->co, n, (PBYTE)&pair, (HVIO) vio_screen); } #ifndef __EMXX__ return; #endif @@ -1565,7 +1565,7 @@ void term_scroll (int top, int bot, int n) * because we never scroll the bottom line of the screen. */ strcpy(start, tparm2(current_term->TI_csr, top, bot)); - strcpy(final, tparm2(current_term->TI_csr, 0, current_term->TI_lines-1)); + strcpy(final, tparm2(current_term->TI_csr, 0, output_screen->li-1)); if (n > 0) { @@ -1595,8 +1595,8 @@ void term_scroll (int top, int bot, int n) else if (current_term->TI_wind && (current_term->TI_ri || current_term->TI_rin) && (current_term->TI_ind || current_term->TI_indn)) { - strcpy(start, tparm4(current_term->TI_wind, top, bot, 0, current_term->TI_cols-1)); - strcpy(final, tparm4(current_term->TI_wind, 0, current_term->TI_lines-1, 0, current_term->TI_cols-1)); + strcpy(start, tparm4(current_term->TI_wind, top, bot, 0, output_screen->co-1)); + strcpy(final, tparm4(current_term->TI_wind, 0, output_screen->li-1, 0, output_screen->co-1)); if (n > 0) {