--- rxvt-unicode/src/screen.C 2006/01/11 02:13:56 1.221 +++ rxvt-unicode/src/screen.C 2006/01/15 05:14:12 1.227 @@ -574,7 +574,7 @@ void rxvt_term::scr_color (unsigned int color, int fgbg) { - if (color > maxTermCOLOR) + if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) color = fgbg; if (fgbg == Color_fg) @@ -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; @@ -3047,6 +3072,15 @@ clicks = ((clicks - 1) % 3) + 1; selection.clicks = clicks; /* save clicks so extend will work */ + if (clicks == 2 && !selection.rect + && HOOK_INVOKE ((this, HOOK_SEL_EXTEND, DT_END))) + { + MEvent.clicks = 1; // what a mess + selection.screen = current_screen; + selection.op = SELECTION_CONT; + return; + } + selection_start_colrow (Pixel2Col (x), Pixel2Row (y)); if (clicks == 2 || clicks == 3) @@ -3351,11 +3385,8 @@ if (ROWCOL_IS_AFTER (selection.end, selection.beg)) selection.end.col--; - if (!HOOK_INVOKE ((this, HOOK_SEL_EXTEND, DT_END))) - { - selection_delimit_word (UP, &selection.beg, &selection.beg); - selection_delimit_word (DN, &selection.end, &selection.end); - } + selection_delimit_word (UP, &selection.beg, &selection.beg); + selection_delimit_word (DN, &selection.end, &selection.end); } else if (selection.clicks == 3) {