… | |
… | |
203 | term_start = 0; |
203 | term_start = 0; |
204 | |
204 | |
205 | talloc = new rxvt_salloc (ncol * sizeof (text_t)); |
205 | talloc = new rxvt_salloc (ncol * sizeof (text_t)); |
206 | ralloc = new rxvt_salloc (ncol * sizeof (rend_t)); |
206 | ralloc = new rxvt_salloc (ncol * sizeof (rend_t)); |
207 | |
207 | |
208 | row_buf = (line_t *)rxvt_calloc (total_rows + nrow, sizeof (line_t)); |
208 | row_buf = (line_t *)rxvt_calloc (total_rows , sizeof (line_t)); |
209 | drawn_buf = (line_t *)rxvt_calloc (nrow , sizeof (line_t)); |
209 | drawn_buf = (line_t *)rxvt_calloc (nrow , sizeof (line_t)); |
210 | swap_buf = (line_t *)rxvt_calloc (nrow , sizeof (line_t)); |
210 | swap_buf = (line_t *)rxvt_calloc (nrow , sizeof (line_t)); |
211 | |
211 | |
212 | for (int row = nrow; row--; ) |
212 | for (int row = nrow; row--; ) |
213 | { |
213 | { |
… | |
… | |
275 | swap_buf [row].clear (); scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE); |
275 | swap_buf [row].clear (); scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE); |
276 | drawn_buf[row].clear (); scr_blank_screen_mem (drawn_buf[row], DEFAULT_RSTYLE); |
276 | drawn_buf[row].clear (); scr_blank_screen_mem (drawn_buf[row], DEFAULT_RSTYLE); |
277 | } |
277 | } |
278 | |
278 | |
279 | line_t *old_buf = row_buf; |
279 | line_t *old_buf = row_buf; |
280 | row_buf = (line_t *)rxvt_calloc (total_rows + nrow, sizeof (line_t)); |
280 | row_buf = (line_t *)rxvt_calloc (total_rows, sizeof (line_t)); |
281 | |
281 | |
282 | int p = MOD (term_start + prev_nrow, prev_total_rows); // previous row |
282 | int p = MOD (term_start + prev_nrow, prev_total_rows); // previous row |
283 | int pend = MOD (term_start + top_row , prev_total_rows); |
283 | int pend = MOD (term_start + top_row , prev_total_rows); |
284 | int q = total_rows; // rewrapped row |
284 | int q = total_rows; // rewrapped row |
285 | |
285 | |
… | |
… | |
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)) |
… | |
… | |
644 | |
649 | |
645 | top_row = max (top_row - count, -saveLines); |
650 | top_row = max (top_row - count, -saveLines); |
646 | |
651 | |
647 | // sever bottommost line |
652 | // sever bottommost line |
648 | { |
653 | { |
649 | line_t &l = ROW(row2 - 1); |
654 | line_t &l = ROW(row2); |
650 | l.is_longer (0); |
655 | l.is_longer (0); |
651 | l.touch (); |
656 | l.touch (); |
652 | } |
657 | } |
653 | |
658 | |
654 | // scroll everything up 'count' lines |
659 | // scroll everything up 'count' lines |
… | |
… | |
682 | else |
687 | else |
683 | scr_blank_screen_mem (l, rstyle); |
688 | scr_blank_screen_mem (l, rstyle); |
684 | } |
689 | } |
685 | |
690 | |
686 | // move and/or clear selection, if any |
691 | // move and/or clear selection, if any |
687 | if (selection.op && current_screen == selection.screen) |
692 | if (selection.op && current_screen == selection.screen |
|
|
693 | && selection.beg.row <= row2) |
688 | { |
694 | { |
689 | selection.beg.row -= count; |
695 | selection.beg.row -= count; |
690 | selection.end.row -= count; |
696 | selection.end.row -= count; |
691 | selection.mark.row -= count; |
697 | selection.mark.row -= count; |
692 | |
698 | |
693 | if (selection.beg.row < top_row |
699 | selection_check (0); |
694 | || selection.end.row < top_row |
|
|
695 | || selection.mark.row < top_row) |
|
|
696 | { |
|
|
697 | CLEAR_ALL_SELECTION (); |
|
|
698 | selection.op = SELECTION_CLEAR; |
|
|
699 | } |
|
|
700 | } |
700 | } |
701 | |
701 | |
702 | // finally move the view window, if desired |
702 | // finally move the view window, if desired |
703 | if (option (Opt_scrollWithBuffer) |
703 | if (option (Opt_scrollWithBuffer) |
704 | && view_start != 0 |
704 | && view_start != 0 |
… | |
… | |
746 | |
746 | |
747 | int rows = row2 - row1 + 1; |
747 | int rows = row2 - row1 + 1; |
748 | |
748 | |
749 | min_it (count, rows); |
749 | min_it (count, rows); |
750 | |
750 | |
751 | line_t *temp_buf = row_buf + total_rows; |
751 | line_t *temp_buf = rxvt_temp_buf<line_t> (rows); |
752 | |
752 | |
753 | for (int row = 0; row < rows; row++) |
753 | for (int row = 0; row < rows; row++) |
754 | { |
754 | { |
755 | temp_buf [row] = ROW(row1 + (row + count + rows) % rows); |
755 | temp_buf [row] = ROW(row1 + (row + count + rows) % rows); |
756 | |
756 | |
… | |
… | |
761 | for (int row = 0; row < rows; row++) |
761 | for (int row = 0; row < rows; row++) |
762 | ROW(row1 + row) = temp_buf [row]; |
762 | ROW(row1 + row) = temp_buf [row]; |
763 | |
763 | |
764 | // sever bottommost line |
764 | // sever bottommost line |
765 | { |
765 | { |
766 | line_t &l = ROW(row2 - 1); |
766 | line_t &l = ROW(row2); |
767 | l.is_longer (0); |
767 | l.is_longer (0); |
768 | l.touch (); |
768 | l.touch (); |
769 | } |
769 | } |
770 | |
|
|
771 | } |
770 | } |
772 | |
771 | |
773 | return count; |
772 | return count; |
774 | } |
773 | } |
775 | |
774 | |
… | |
… | |
781 | 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 |
782 | { |
781 | { |
783 | if (len <= 0) /* sanity */ |
782 | if (len <= 0) /* sanity */ |
784 | return; |
783 | return; |
785 | |
784 | |
786 | unsigned char checksel; |
785 | bool checksel; |
787 | unicode_t c; |
786 | unicode_t c; |
788 | int ncol = this->ncol; |
787 | int ncol = this->ncol; |
789 | const wchar_t *strend = str + len; |
788 | const wchar_t *strend = str + len; |
790 | |
789 | |
791 | want_refresh = 1; |
790 | want_refresh = 1; |
… | |
… | |
1313 | scr_blank_line (line, col, num, rstyle); |
1312 | scr_blank_line (line, col, num, rstyle); |
1314 | } |
1313 | } |
1315 | |
1314 | |
1316 | /* ------------------------------------------------------------------------- */ |
1315 | /* ------------------------------------------------------------------------- */ |
1317 | /* |
1316 | /* |
1318 | * Erase part of whole of the screen |
1317 | * Erase part or whole of the screen |
1319 | * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J |
1318 | * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J |
1320 | * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J |
1319 | * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J |
1321 | * XTERM_SEQ: Clear whole screen : ESC [ 2 J |
1320 | * XTERM_SEQ: Clear whole screen : ESC [ 2 J |
1322 | */ |
1321 | */ |
1323 | void |
1322 | void |
… | |
… | |
1332 | ZERO_SCROLLBACK (); |
1331 | ZERO_SCROLLBACK (); |
1333 | |
1332 | |
1334 | switch (mode) |
1333 | switch (mode) |
1335 | { |
1334 | { |
1336 | case 0: /* erase to end of screen */ |
1335 | case 0: /* erase to end of screen */ |
1337 | selection_check (1); |
|
|
1338 | scr_erase_line (0); |
1336 | scr_erase_line (0); |
1339 | row = screen.cur.row + 1; /* possible OOB */ |
1337 | row = screen.cur.row + 1; /* possible OOB */ |
1340 | num = nrow - row; |
1338 | num = nrow - row; |
1341 | break; |
1339 | break; |
1342 | case 1: /* erase to beginning of screen */ |
1340 | case 1: /* erase to beginning of screen */ |
1343 | selection_check (3); |
|
|
1344 | scr_erase_line (1); |
1341 | scr_erase_line (1); |
1345 | row = 0; |
1342 | row = 0; |
1346 | num = screen.cur.row; |
1343 | num = screen.cur.row; |
1347 | break; |
1344 | break; |
1348 | case 2: /* erase whole screen */ |
1345 | case 2: /* erase whole screen */ |
1349 | selection_check (3); |
|
|
1350 | row = 0; |
1346 | row = 0; |
1351 | num = nrow; |
1347 | num = nrow; |
1352 | break; |
1348 | break; |
1353 | default: |
1349 | default: |
1354 | return; |
1350 | return; |
… | |
… | |
1425 | |
1421 | |
1426 | want_refresh = 1; |
1422 | want_refresh = 1; |
1427 | ZERO_SCROLLBACK (); |
1423 | ZERO_SCROLLBACK (); |
1428 | |
1424 | |
1429 | num_scr_allow = 0; |
1425 | num_scr_allow = 0; |
1430 | 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 (); |
1431 | |
1431 | |
1432 | fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); |
1432 | fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); |
1433 | for (int row = nrow; row--; ) |
1433 | for (int row = nrow; row--; ) |
1434 | { |
1434 | { |
1435 | line_t &line = ROW(row); |
1435 | line_t &line = ROW(row); |
… | |
… | |
2048 | * A: set up vars |
2048 | * A: set up vars |
2049 | */ |
2049 | */ |
2050 | refresh_count = 0; |
2050 | refresh_count = 0; |
2051 | |
2051 | |
2052 | unsigned int old_screen_flags = screen.flags; |
2052 | unsigned int old_screen_flags = screen.flags; |
2053 | char have_bg = 0; |
2053 | bool have_bg = 0; |
2054 | #ifdef HAVE_BG_PIXMAP |
2054 | #ifdef HAVE_BG_PIXMAP |
2055 | have_bg = bg_pixmap != None; |
2055 | have_bg = bg_pixmap != None; |
2056 | #endif |
2056 | #endif |
2057 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2057 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2058 | |
2058 | |
… | |
… | |
2064 | HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); |
2064 | HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); |
2065 | #if ENABLE_OVERLAY |
2065 | #if ENABLE_OVERLAY |
2066 | scr_swap_overlay (); |
2066 | scr_swap_overlay (); |
2067 | #endif |
2067 | #endif |
2068 | |
2068 | |
2069 | char showcursor = screen.flags & Screen_VisibleCursor; |
2069 | bool showcursor = screen.flags & Screen_VisibleCursor; |
2070 | |
2070 | |
2071 | /* |
2071 | /* |
2072 | * C: set the cursor character (s) |
2072 | * C: set the cursor character (s) |
2073 | */ |
2073 | */ |
2074 | { |
2074 | { |
2075 | unsigned char setoldcursor; |
2075 | bool setoldcursor; |
2076 | |
2076 | |
2077 | #ifdef CURSOR_BLINK |
2077 | #ifdef CURSOR_BLINK |
2078 | if (hidden_cursor) |
2078 | if (hidden_cursor) |
2079 | showcursor = 0; |
2079 | showcursor = 0; |
2080 | #endif |
2080 | #endif |
… | |
… | |
2167 | { |
2167 | { |
2168 | int16_t nits; |
2168 | int16_t nits; |
2169 | int i = num_scr; |
2169 | int i = num_scr; |
2170 | int j; |
2170 | int j; |
2171 | int len, wlen; |
2171 | int len, wlen; |
2172 | dLocal (int, num_scr); |
|
|
2173 | |
2172 | |
2174 | j = nrow; |
2173 | j = nrow; |
2175 | wlen = len = -1; |
2174 | wlen = len = -1; |
2176 | row = i > 0 ? 0 : j - 1; |
2175 | row = i > 0 ? 0 : j - 1; |
2177 | |
2176 | |
… | |
… | |
2564 | { |
2563 | { |
2565 | if (transparent) |
2564 | if (transparent) |
2566 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2565 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2567 | else |
2566 | else |
2568 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); |
2567 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); |
2569 | scrollBar.state = STATE_IDLE; |
2568 | scrollBar.state = SB_STATE_IDLE; |
2570 | scrollBar.show (0); |
2569 | scrollBar.show (0); |
2571 | } |
2570 | } |
2572 | |
2571 | |
2573 | if (refresh) |
2572 | if (refresh) |
2574 | { |
2573 | { |
… | |
… | |
2668 | */ |
2667 | */ |
2669 | #if 0 |
2668 | #if 0 |
2670 | void |
2669 | void |
2671 | rxvt_term::scr_dump (int fd) NOTHROW |
2670 | rxvt_term::scr_dump (int fd) NOTHROW |
2672 | { |
2671 | { |
2673 | int row, wrote; |
2672 | // if this method is needed, it can be implemented by factoring the |
2674 | unsigned int width, towrite; |
2673 | // relevant code in scr_printscreen |
2675 | const char r1[] = "\n"; |
|
|
2676 | |
|
|
2677 | for (row = saveLines + top_row; |
|
|
2678 | row < saveLines + nrow - 1; row++) |
|
|
2679 | { |
|
|
2680 | width = row_buf[row].l >= 0 ? row_buf[row].l |
|
|
2681 | : ncol; |
|
|
2682 | for (towrite = width; towrite; towrite -= wrote) |
|
|
2683 | { |
|
|
2684 | wrote = write (fd, & (row_buf[row].t[width - towrite]), |
|
|
2685 | towrite); |
|
|
2686 | if (wrote < 0) |
|
|
2687 | return; /* XXX: death, no report */ |
|
|
2688 | } |
|
|
2689 | if (row_buf[row].l >= 0) |
|
|
2690 | if (write (fd, r1, 1) <= 0) |
|
|
2691 | return; /* XXX: death, no report */ |
|
|
2692 | } |
|
|
2693 | } |
2674 | } |
2694 | #endif |
2675 | #endif |
2695 | |
2676 | |
2696 | /* ------------------------------------------------------------------------- * |
2677 | /* ------------------------------------------------------------------------- * |
2697 | * CHARACTER SELECTION * |
2678 | * CHARACTER SELECTION * |
2698 | * ------------------------------------------------------------------------- */ |
2679 | * ------------------------------------------------------------------------- */ |
2699 | void |
2680 | void |
2700 | rxvt_term::selection_check (int check_more) NOTHROW |
2681 | rxvt_term::selection_check (int check_more) NOTHROW |
2701 | { |
2682 | { |
2702 | row_col_t pos; |
|
|
2703 | |
|
|
2704 | if (!selection.op) |
2683 | if (!selection.op) |
2705 | return; |
2684 | return; |
2706 | |
2685 | |
2707 | pos.row = pos.col = 0; |
|
|
2708 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
2686 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
2709 | || !IN_RANGE_EXC (selection.mark.row, top_row, nrow) |
2687 | || !IN_RANGE_EXC (selection.mark.row, top_row, nrow) |
2710 | || !IN_RANGE_EXC (selection.end.row, top_row, nrow) |
2688 | || !IN_RANGE_EXC (selection.end.row, top_row, nrow) |
2711 | || (check_more == 1 |
2689 | || (check_more == 1 |
2712 | && current_screen == selection.screen |
2690 | && current_screen == selection.screen |
2713 | && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) |
2691 | && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) |
2714 | && ROWCOL_IS_BEFORE (screen.cur, selection.end)) |
2692 | && ROWCOL_IS_BEFORE (screen.cur, selection.end))) |
2715 | || (check_more == 2 |
|
|
2716 | && ROWCOL_IS_BEFORE (selection.beg, pos) |
|
|
2717 | && ROWCOL_IS_AFTER (selection.end, pos)) |
|
|
2718 | || (check_more == 3 |
|
|
2719 | && ROWCOL_IS_AFTER (selection.end, pos)) |
|
|
2720 | || (check_more == 4 /* screen width change */ |
|
|
2721 | && (selection.beg.row != selection.end.row |
|
|
2722 | || selection.end.col > ncol))) |
|
|
2723 | CLEAR_SELECTION (); |
2693 | CLEAR_ALL_SELECTION (); |
2724 | } |
2694 | } |
2725 | |
2695 | |
2726 | /* ------------------------------------------------------------------------- */ |
2696 | /* ------------------------------------------------------------------------- */ |
2727 | /* |
2697 | /* |
2728 | * Paste a selection direct to the command fd |
2698 | * Paste a selection direct to the command fd |