--- rxvt-unicode/src/screen.C 2006/01/12 03:32:56 1.224 +++ rxvt-unicode/src/screen.C 2006/01/15 05:14:12 1.227 @@ -615,15 +615,48 @@ if (count > 0 && row1 == 0 - && row2 == nrow - 1 && (current_screen == PRIMARY || OPTION (Opt_secondaryScroll))) { nsaved = min (nsaved + count, saveLines); HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, nsaved, DT_END)); + // scroll everything up 'count' lines term_start = (term_start + count) % total_rows; + { + // severe bottommost scrolled line + line_t &l = ROW(row2 - count); + l.touch (); + l.is_longer (0); + } + + // erase newly scorlled-in lines + for (int i = count; i; --i ) + { + // basically this is a slightly optimized scr_blank_screen_mem + // it is worth the effort on slower machines + line_t &l = ROW(nrow - i); + + scr_blank_line (l, 0, l.l, rstyle); + + l.l = 0; + l.f = 0; + } + + // now copy lines below the scroll region bottom to the + // bottom of the screen again, so they look as if they + // hadn't moved. + for (int i = nrow; --i > row2; ) + { + line_t &l1 = ROW(i - count); + line_t &l2 = ROW(i); + + ::swap (l1, l2); + l2.touch (); + } + + // move and/or clear selection, if any if (selection.op && current_screen == selection.screen) { selection.beg.row -= count; @@ -639,18 +672,7 @@ } } - for (int i = count; i--; ) - { - // basically thi is a slightly optimized scr_blank_screen_mem - // it is worth the effort on slower machines - line_t &l = ROW(row2 - i); - - scr_blank_line (l, 0, l.l, rstyle); - - l.l = 0; - l.f = 0; - } - + // finally move the view window, if desired if (OPTION (Opt_scrollWithBuffer) && view_start != 0 && view_start != saveLines) @@ -3023,7 +3045,10 @@ return true; } else - return false; + { + selection_clear (); + return false; + } #if 0 XTextProperty ct; @@ -3051,6 +3076,8 @@ && HOOK_INVOKE ((this, HOOK_SEL_EXTEND, DT_END))) { MEvent.clicks = 1; // what a mess + selection.screen = current_screen; + selection.op = SELECTION_CONT; return; }