… | |
… | |
631 | rxvt_term::scr_scroll_text (int row1, int row2, int count) NOTHROW |
631 | rxvt_term::scr_scroll_text (int row1, int row2, int count) NOTHROW |
632 | { |
632 | { |
633 | if (count == 0 || (row1 > row2)) |
633 | if (count == 0 || (row1 > row2)) |
634 | return 0; |
634 | return 0; |
635 | |
635 | |
636 | int rows = row2 - row1 + 1; |
|
|
637 | |
|
|
638 | min_it (count, rows); |
|
|
639 | |
|
|
640 | want_refresh = 1; |
636 | want_refresh = 1; |
641 | num_scr += count; |
637 | num_scr += count; |
642 | |
638 | |
643 | if (count > 0 |
639 | if (count > 0 |
644 | && row1 == 0 |
640 | && row1 == 0 |
645 | && (current_screen == PRIMARY || option (Opt_secondaryScroll))) |
641 | && (current_screen == PRIMARY || option (Opt_secondaryScroll))) |
646 | { |
642 | { |
|
|
643 | min_it (count, row2 - total_rows); |
|
|
644 | |
647 | top_row = max (top_row - count, -saveLines); |
645 | top_row = max (top_row - count, -saveLines); |
648 | |
646 | |
649 | // scroll everything up 'count' lines |
647 | // scroll everything up 'count' lines |
650 | term_start = (term_start + count) % total_rows; |
648 | term_start = (term_start + count) % total_rows; |
651 | |
649 | |
… | |
… | |
659 | // erase newly scrolled-in lines |
657 | // erase newly scrolled-in lines |
660 | for (int i = count; i--; ) |
658 | for (int i = count; i--; ) |
661 | { |
659 | { |
662 | line_t &l = ROW(nrow - 1 - i); |
660 | line_t &l = ROW(nrow - 1 - i); |
663 | |
661 | |
664 | // optimize if already cleared, can be significant on slow machines |
662 | // optimise if already cleared, can be significant on slow machines |
665 | // could be rolled into scr_blank_screen_mem |
663 | // could be rolled into scr_blank_screen_mem |
666 | if (l.r && l.l < ncol - 1 && !((l.r[l.l + 1] ^ rstyle) & (RS_fgMask | RS_bgMask))) |
664 | if (l.r && l.l < ncol - 1 && !((l.r[l.l + 1] ^ rstyle) & (RS_fgMask | RS_bgMask))) |
667 | { |
665 | { |
668 | scr_blank_line (l, 0, l.l, rstyle); |
666 | scr_blank_line (l, 0, l.l, rstyle); |
669 | l.l = 0; |
667 | l.l = 0; |
… | |
… | |
735 | } |
733 | } |
736 | } |
734 | } |
737 | |
735 | |
738 | // use a simple and robust scrolling algorithm, this |
736 | // use a simple and robust scrolling algorithm, this |
739 | // part of scr_scroll_text is not time-critical. |
737 | // part of scr_scroll_text is not time-critical. |
|
|
738 | |
|
|
739 | int rows = row2 - row1 + 1; |
|
|
740 | |
|
|
741 | min_it (count, rows); |
740 | |
742 | |
741 | line_t *temp_buf = row_buf + total_rows; |
743 | line_t *temp_buf = row_buf + total_rows; |
742 | |
744 | |
743 | for (int row = 0; row < rows; row++) |
745 | for (int row = 0; row < rows; row++) |
744 | { |
746 | { |