Use output_screen size instead of current_term in term_scroll

This fixes a regression in commmit 70ac43ce77,
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.
This commit is contained in:
Kevin Easton
2018-05-05 11:31:31 +10:00
parent 208fddb9f5
commit 1e97709bd8

View File

@@ -1509,8 +1509,8 @@ void term_scroll (int top, int bot, int n)
char thing[128], final[128], start[128]; char thing[128], final[128], start[128];
#ifdef __EMX__ #ifdef __EMX__
pair[0] = ' '; pair[1] = 7; pair[0] = ' '; pair[1] = 7;
if (n > 0) VioScrollUp(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, current_term->TI_cols, 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__ #ifndef __EMXX__
return; return;
#endif #endif
@@ -1565,7 +1565,7 @@ void term_scroll (int top, int bot, int n)
* because we never scroll the bottom line of the screen. * because we never scroll the bottom line of the screen.
*/ */
strcpy(start, tparm2(current_term->TI_csr, top, bot)); 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) 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)) 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(start, tparm4(current_term->TI_wind, top, bot, 0, output_screen->co-1));
strcpy(final, tparm4(current_term->TI_wind, 0, current_term->TI_lines-1, 0, current_term->TI_cols-1)); strcpy(final, tparm4(current_term->TI_wind, 0, output_screen->li-1, 0, output_screen->co-1));
if (n > 0) if (n > 0)
{ {