Here's another fix for a resize-related bug. This one's triggered by _reducing_
the number of lines while there is little or no text in the scrollback buffer.
For some reason the existing code calculates the number of lines to scroll back
using
if (nrow < prev_nrow) {
/* delete rows */
k = min(r->TermWin.nscrolled, prev_nrow - nrow);
which will cause the earliest text, which should be put in the scrollback
buffer, to be discarded if r->TermWin.nscrolled is small or zero. The attached
patch replaces this by a comparison between prev_nrow - nrow [the number of
lines the terminal has been reduced by] and (prev_nrow - 1) - r->screen.cur.row
[the number of lines below the active one]. If the first is greater than the
second, the terminal must be scrolled back by the difference between them.
My previous patch got tab-expanded by my mailer, so I've repeated it with this
one.
Malcolm
--- screen.c~ Sat Jun 22 20:27:35 2002
+++ screen.c Sat Jun 22 20:32:01 2002
@@ -258,7 +258,7 @@
if (nrow < prev_nrow) {
/* delete rows */
- k = min(r->TermWin.nscrolled, prev_nrow - nrow);
+ k = max (0, (int)((prev_nrow - nrow) - ((prev_nrow - 1) -
+r->screen.cur.row)));
rxvt_scroll_text(r, 0, (int)prev_nrow - 1, k, 1);
for (i = nrow; i < prev_nrow; i++) {
j = i + r->TermWin.saveLines;
@@ -315,6 +315,7 @@
if (k > 0) {
rxvt_scroll_text(r, 0, (int)nrow - 1, -k, 1);
r->screen.cur.row += k;
+ r->screen.s_cur.row += k;
r->TermWin.nscrolled -= k;
}
#ifdef DEBUG_STRICT