… | |
… | |
549 | return; |
549 | return; |
550 | |
550 | |
551 | want_refresh = 1; |
551 | want_refresh = 1; |
552 | view_start = 0; |
552 | view_start = 0; |
553 | |
553 | |
554 | selection_check (2); /* check for boundary cross */ |
554 | /* check for boundary cross */ |
|
|
555 | row_col_t pos; |
|
|
556 | pos.row = pos.col = 0; |
|
|
557 | if (ROWCOL_IS_BEFORE (selection.beg, pos) |
|
|
558 | && ROWCOL_IS_AFTER (selection.end, pos)) |
|
|
559 | CLEAR_SELECTION (); |
555 | |
560 | |
556 | current_screen = scrn; |
561 | current_screen = scrn; |
557 | |
562 | |
558 | #if NSCREENS |
563 | #if NSCREENS |
559 | if (option (Opt_secondaryScreen)) |
564 | if (option (Opt_secondaryScreen)) |
… | |
… | |
681 | } |
686 | } |
682 | else |
687 | else |
683 | scr_blank_screen_mem (l, rstyle); |
688 | scr_blank_screen_mem (l, rstyle); |
684 | } |
689 | } |
685 | |
690 | |
|
|
691 | // move and/or clear selection, if any |
|
|
692 | if (selection.op && current_screen == selection.screen |
|
|
693 | && selection.beg.row <= row2) |
|
|
694 | { |
|
|
695 | selection.beg.row -= count; |
|
|
696 | selection.end.row -= count; |
|
|
697 | selection.mark.row -= count; |
|
|
698 | |
|
|
699 | selection_check (0); |
|
|
700 | } |
|
|
701 | |
686 | // finally move the view window, if desired |
702 | // finally move the view window, if desired |
687 | if (option (Opt_scrollWithBuffer) |
703 | if (option (Opt_scrollWithBuffer) |
688 | && view_start != 0 |
704 | && view_start != 0 |
689 | && view_start != -saveLines) |
705 | && view_start != -saveLines) |
690 | scr_page (UP, count); |
706 | scr_page (UP, count); |
… | |
… | |
692 | if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) |
708 | if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) |
693 | HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, top_row, DT_END)); |
709 | HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, top_row, DT_END)); |
694 | } |
710 | } |
695 | else |
711 | else |
696 | { |
712 | { |
|
|
713 | if (selection.op && current_screen == selection.screen) |
|
|
714 | { |
|
|
715 | if ((selection.beg.row < row1 && selection.end.row > row1) |
|
|
716 | || (selection.beg.row < row2 && selection.end.row > row2) |
|
|
717 | || (selection.beg.row - count < row1 && selection.beg.row >= row1) |
|
|
718 | || (selection.beg.row - count > row2 && selection.beg.row <= row2) |
|
|
719 | || (selection.end.row - count < row1 && selection.end.row >= row1) |
|
|
720 | || (selection.end.row - count > row2 && selection.end.row <= row2)) |
|
|
721 | { |
|
|
722 | CLEAR_ALL_SELECTION (); |
|
|
723 | selection.op = SELECTION_CLEAR; |
|
|
724 | } |
|
|
725 | else if (selection.end.row >= row1 && selection.end.row <= row2) |
|
|
726 | { |
|
|
727 | /* move selected region too */ |
|
|
728 | selection.beg.row -= count; |
|
|
729 | selection.end.row -= count; |
|
|
730 | selection.mark.row -= count; |
|
|
731 | |
|
|
732 | selection_check (0); |
|
|
733 | } |
|
|
734 | } |
|
|
735 | |
697 | // use a simple and robust scrolling algorithm, this |
736 | // use a simple and robust scrolling algorithm, this |
698 | // part of scr_scroll_text is not time-critical. |
737 | // part of scr_scroll_text is not time-critical. |
699 | |
738 | |
700 | // sever line above scroll region |
739 | // sever line above scroll region |
701 | if (row1) |
740 | if (row1) |
… | |
… | |
728 | l.is_longer (0); |
767 | l.is_longer (0); |
729 | l.touch (); |
768 | l.touch (); |
730 | } |
769 | } |
731 | } |
770 | } |
732 | |
771 | |
733 | // move and/or clear selection, if any |
|
|
734 | if (selection.op && current_screen == selection.screen) |
|
|
735 | { |
|
|
736 | if ((selection.beg.row < row1 && selection.end.row > row1) |
|
|
737 | || (selection.beg.row < row2 && selection.end.row > row2) |
|
|
738 | || (selection.beg.row - count < row1 && selection.beg.row >= row1) |
|
|
739 | || (selection.beg.row - count > row2 && selection.beg.row <= row2) |
|
|
740 | || (selection.end.row - count < row1 && selection.end.row >= row1) |
|
|
741 | || (selection.end.row - count > row2 && selection.end.row <= row2)) |
|
|
742 | CLEAR_ALL_SELECTION (); |
|
|
743 | else if (selection.end.row >= row1 && selection.end.row <= row2) |
|
|
744 | { |
|
|
745 | /* move selected region too */ |
|
|
746 | selection.beg.row -= count; |
|
|
747 | selection.end.row -= count; |
|
|
748 | selection.mark.row -= count; |
|
|
749 | |
|
|
750 | selection_check (0); |
|
|
751 | } |
|
|
752 | } |
|
|
753 | |
|
|
754 | return count; |
772 | return count; |
755 | } |
773 | } |
756 | |
774 | |
757 | /* ------------------------------------------------------------------------- */ |
775 | /* ------------------------------------------------------------------------- */ |
758 | /* |
776 | /* |
… | |
… | |
762 | rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) NOTHROW |
780 | rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) NOTHROW |
763 | { |
781 | { |
764 | if (len <= 0) /* sanity */ |
782 | if (len <= 0) /* sanity */ |
765 | return; |
783 | return; |
766 | |
784 | |
767 | unsigned char checksel; |
785 | bool checksel; |
768 | unicode_t c; |
786 | unicode_t c; |
769 | int ncol = this->ncol; |
787 | int ncol = this->ncol; |
770 | const wchar_t *strend = str + len; |
788 | const wchar_t *strend = str + len; |
771 | |
789 | |
772 | want_refresh = 1; |
790 | want_refresh = 1; |
… | |
… | |
1313 | ZERO_SCROLLBACK (); |
1331 | ZERO_SCROLLBACK (); |
1314 | |
1332 | |
1315 | switch (mode) |
1333 | switch (mode) |
1316 | { |
1334 | { |
1317 | case 0: /* erase to end of screen */ |
1335 | case 0: /* erase to end of screen */ |
1318 | selection_check (1); |
|
|
1319 | scr_erase_line (0); |
1336 | scr_erase_line (0); |
1320 | row = screen.cur.row + 1; /* possible OOB */ |
1337 | row = screen.cur.row + 1; /* possible OOB */ |
1321 | num = nrow - row; |
1338 | num = nrow - row; |
1322 | break; |
1339 | break; |
1323 | case 1: /* erase to beginning of screen */ |
1340 | case 1: /* erase to beginning of screen */ |
1324 | selection_check (3); |
|
|
1325 | scr_erase_line (1); |
1341 | scr_erase_line (1); |
1326 | row = 0; |
1342 | row = 0; |
1327 | num = screen.cur.row; |
1343 | num = screen.cur.row; |
1328 | break; |
1344 | break; |
1329 | case 2: /* erase whole screen */ |
1345 | case 2: /* erase whole screen */ |
1330 | selection_check (3); |
|
|
1331 | row = 0; |
1346 | row = 0; |
1332 | num = nrow; |
1347 | num = nrow; |
1333 | break; |
1348 | break; |
1334 | default: |
1349 | default: |
1335 | return; |
1350 | return; |
… | |
… | |
1406 | |
1421 | |
1407 | want_refresh = 1; |
1422 | want_refresh = 1; |
1408 | ZERO_SCROLLBACK (); |
1423 | ZERO_SCROLLBACK (); |
1409 | |
1424 | |
1410 | num_scr_allow = 0; |
1425 | num_scr_allow = 0; |
1411 | selection_check (3); |
1426 | |
|
|
1427 | row_col_t pos; |
|
|
1428 | pos.row = pos.col = 0; |
|
|
1429 | if (ROWCOL_IS_AFTER (selection.end, pos)) |
|
|
1430 | CLEAR_SELECTION (); |
1412 | |
1431 | |
1413 | fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); |
1432 | fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); |
1414 | for (int row = nrow; row--; ) |
1433 | for (int row = nrow; row--; ) |
1415 | { |
1434 | { |
1416 | line_t &line = ROW(row); |
1435 | line_t &line = ROW(row); |
… | |
… | |
2029 | * A: set up vars |
2048 | * A: set up vars |
2030 | */ |
2049 | */ |
2031 | refresh_count = 0; |
2050 | refresh_count = 0; |
2032 | |
2051 | |
2033 | unsigned int old_screen_flags = screen.flags; |
2052 | unsigned int old_screen_flags = screen.flags; |
2034 | char have_bg = 0; |
2053 | bool have_bg = 0; |
2035 | #ifdef HAVE_BG_PIXMAP |
2054 | #ifdef HAVE_BG_PIXMAP |
2036 | have_bg = bg_pixmap != None; |
2055 | have_bg = bg_pixmap != None; |
2037 | #endif |
2056 | #endif |
2038 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2057 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2039 | |
2058 | |
… | |
… | |
2045 | HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); |
2064 | HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); |
2046 | #if ENABLE_OVERLAY |
2065 | #if ENABLE_OVERLAY |
2047 | scr_swap_overlay (); |
2066 | scr_swap_overlay (); |
2048 | #endif |
2067 | #endif |
2049 | |
2068 | |
2050 | char showcursor = screen.flags & Screen_VisibleCursor; |
2069 | bool showcursor = screen.flags & Screen_VisibleCursor; |
2051 | |
2070 | |
2052 | /* |
2071 | /* |
2053 | * C: set the cursor character (s) |
2072 | * C: set the cursor character (s) |
2054 | */ |
2073 | */ |
2055 | { |
2074 | { |
2056 | unsigned char setoldcursor; |
2075 | bool setoldcursor; |
2057 | |
2076 | |
2058 | #ifdef CURSOR_BLINK |
2077 | #ifdef CURSOR_BLINK |
2059 | if (hidden_cursor) |
2078 | if (hidden_cursor) |
2060 | showcursor = 0; |
2079 | showcursor = 0; |
2061 | #endif |
2080 | #endif |
… | |
… | |
2681 | rxvt_term::selection_check (int check_more) NOTHROW |
2700 | rxvt_term::selection_check (int check_more) NOTHROW |
2682 | { |
2701 | { |
2683 | if (!selection.op) |
2702 | if (!selection.op) |
2684 | return; |
2703 | return; |
2685 | |
2704 | |
2686 | row_col_t pos; |
|
|
2687 | pos.row = pos.col = 0; |
|
|
2688 | |
|
|
2689 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
2705 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
2690 | || !IN_RANGE_EXC (selection.mark.row, top_row, nrow) |
2706 | || !IN_RANGE_EXC (selection.mark.row, top_row, nrow) |
2691 | || !IN_RANGE_EXC (selection.end.row, top_row, nrow) |
2707 | || !IN_RANGE_EXC (selection.end.row, top_row, nrow) |
2692 | || (check_more == 1 |
2708 | || (check_more == 1 |
2693 | && current_screen == selection.screen |
2709 | && current_screen == selection.screen |
2694 | && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) |
2710 | && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) |
2695 | && ROWCOL_IS_BEFORE (screen.cur, selection.end)) |
2711 | && ROWCOL_IS_BEFORE (screen.cur, selection.end))) |
2696 | || (check_more == 2 |
|
|
2697 | && ROWCOL_IS_BEFORE (selection.beg, pos) |
|
|
2698 | && ROWCOL_IS_AFTER (selection.end, pos)) |
|
|
2699 | || (check_more == 3 |
|
|
2700 | && ROWCOL_IS_AFTER (selection.end, pos)) |
|
|
2701 | || (check_more == 4 /* screen width change */ |
|
|
2702 | && (selection.beg.row != selection.end.row |
|
|
2703 | || selection.end.col > ncol))) |
|
|
2704 | CLEAR_ALL_SELECTION (); |
2712 | CLEAR_ALL_SELECTION (); |
2705 | } |
2713 | } |
2706 | |
2714 | |
2707 | /* ------------------------------------------------------------------------- */ |
2715 | /* ------------------------------------------------------------------------- */ |
2708 | /* |
2716 | /* |