… | |
… | |
286 | ocur.row = MOD (term_start + ocur.row, prev_total_rows); |
286 | ocur.row = MOD (term_start + ocur.row, prev_total_rows); |
287 | |
287 | |
288 | do |
288 | do |
289 | { |
289 | { |
290 | p = MOD (p - 1, prev_total_rows); |
290 | p = MOD (p - 1, prev_total_rows); |
291 | #ifdef DEBUG_STRICT |
|
|
292 | assert (old_buf [MOD (p, prev_total_rows)].t); |
291 | assert (old_buf [MOD (p, prev_total_rows)].t); |
293 | #endif |
|
|
294 | int plines = 1; |
292 | int plines = 1; |
295 | int llen = old_buf [MOD (p, prev_total_rows)].l; |
293 | int llen = old_buf [MOD (p, prev_total_rows)].l; |
296 | |
294 | |
297 | while (p != pend && old_buf [MOD (p - 1, prev_total_rows)].is_longer ()) |
295 | while (p != pend && old_buf [MOD (p - 1, prev_total_rows)].is_longer ()) |
298 | { |
296 | { |
… | |
… | |
510 | } |
508 | } |
511 | |
509 | |
512 | /* boundary check in case screen size changed between SAVE and RESTORE */ |
510 | /* boundary check in case screen size changed between SAVE and RESTORE */ |
513 | min_it (s->cur.row, nrow - 1); |
511 | min_it (s->cur.row, nrow - 1); |
514 | min_it (s->cur.col, ncol - 1); |
512 | min_it (s->cur.col, ncol - 1); |
515 | #ifdef DEBUG_STRICT |
|
|
516 | assert (s->cur.row >= 0); |
513 | assert (s->cur.row >= 0); |
517 | assert (s->cur.col >= 0); |
514 | assert (s->cur.col >= 0); |
518 | #endif |
|
|
519 | } |
515 | } |
520 | |
516 | |
521 | void |
517 | void |
522 | rxvt_term::scr_swap_screen () |
518 | rxvt_term::scr_swap_screen () |
523 | { |
519 | { |
… | |
… | |
783 | scr_scroll_text (screen.tscroll, screen.bscroll, minlines); |
779 | scr_scroll_text (screen.tscroll, screen.bscroll, minlines); |
784 | screen.cur.row -= minlines; |
780 | screen.cur.row -= minlines; |
785 | } |
781 | } |
786 | } |
782 | } |
787 | |
783 | |
788 | #ifdef DEBUG_STRICT |
|
|
789 | assert (screen.cur.col < ncol); |
784 | assert (screen.cur.col < ncol); |
790 | assert (screen.cur.row < nrow |
785 | assert (screen.cur.row < nrow |
791 | && screen.cur.row >= top_row); |
786 | && screen.cur.row >= top_row); |
792 | #endif |
|
|
793 | int row = screen.cur.row; |
787 | int row = screen.cur.row; |
794 | |
788 | |
795 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
789 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
796 | |
790 | |
797 | line_t *line = &ROW(row); |
791 | line_t *line = &ROW(row); |
… | |
… | |
1001 | #endif |
995 | #endif |
1002 | } |
996 | } |
1003 | |
997 | |
1004 | max_it (line->l, screen.cur.col); |
998 | max_it (line->l, screen.cur.col); |
1005 | |
999 | |
1006 | #ifdef DEBUG_STRICT |
|
|
1007 | assert (screen.cur.row >= 0); |
1000 | assert (screen.cur.row >= 0); |
1008 | #endif |
|
|
1009 | } |
1001 | } |
1010 | |
1002 | |
1011 | /* ------------------------------------------------------------------------- */ |
1003 | /* ------------------------------------------------------------------------- */ |
1012 | /* |
1004 | /* |
1013 | * Process Backspace. Move back the cursor back a position, wrap if have to |
1005 | * Process Backspace. Move back the cursor back a position, wrap if have to |
… | |
… | |
2008 | * screen.text/screen.rend contain what the screen will change to. |
2000 | * screen.text/screen.rend contain what the screen will change to. |
2009 | */ |
2001 | */ |
2010 | void |
2002 | void |
2011 | rxvt_term::scr_refresh () NOTHROW |
2003 | rxvt_term::scr_refresh () NOTHROW |
2012 | { |
2004 | { |
2013 | unsigned char have_bg, |
|
|
2014 | showcursor; /* show the cursor */ |
|
|
2015 | int16_t col, row, /* column/row we're processing */ |
2005 | int16_t col, row, /* column/row we're processing */ |
2016 | ocrow; /* old cursor row */ |
2006 | ocrow; /* old cursor row */ |
2017 | int i; /* tmp */ |
2007 | int i; /* tmp */ |
2018 | #ifndef NO_CURSORCOLOR |
2008 | #ifndef NO_CURSORCOLOR |
2019 | rend_t cc1; /* store colours at cursor position (s) */ |
2009 | rend_t cc1; /* store colours at cursor position (s) */ |
… | |
… | |
2030 | /* |
2020 | /* |
2031 | * A: set up vars |
2021 | * A: set up vars |
2032 | */ |
2022 | */ |
2033 | refresh_count = 0; |
2023 | refresh_count = 0; |
2034 | |
2024 | |
|
|
2025 | unsigned int old_screen_flags = screen.flags; |
2035 | have_bg = 0; |
2026 | char have_bg = 0; |
2036 | #ifdef HAVE_BG_PIXMAP |
2027 | #ifdef HAVE_BG_PIXMAP |
2037 | have_bg = bgPixmap.pixmap != None; |
2028 | have_bg = bgPixmap.pixmap != None; |
2038 | #endif |
2029 | #endif |
2039 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2030 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2040 | |
2031 | |
2041 | /* |
2032 | /* |
2042 | * B: reverse any characters which are selected |
2033 | * B: reverse any characters which are selected |
2043 | */ |
2034 | */ |
2044 | scr_reverse_selection (); |
2035 | scr_reverse_selection (); |
|
|
2036 | |
|
|
2037 | HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); |
|
|
2038 | #if ENABLE_OVERLAY |
|
|
2039 | scr_swap_overlay (); |
|
|
2040 | #endif |
|
|
2041 | |
|
|
2042 | char showcursor = screen.flags & Screen_VisibleCursor; |
2045 | |
2043 | |
2046 | /* |
2044 | /* |
2047 | * C: set the cursor character (s) |
2045 | * C: set the cursor character (s) |
2048 | */ |
2046 | */ |
2049 | { |
2047 | { |
2050 | unsigned char setoldcursor; |
2048 | unsigned char setoldcursor; |
2051 | |
2049 | |
2052 | showcursor = (screen.flags & Screen_VisibleCursor); |
|
|
2053 | #ifdef CURSOR_BLINK |
2050 | #ifdef CURSOR_BLINK |
2054 | if (hidden_cursor) |
2051 | if (hidden_cursor) |
2055 | showcursor = 0; |
2052 | showcursor = 0; |
2056 | #endif |
2053 | #endif |
2057 | |
2054 | |
… | |
… | |
2130 | oldcursor.col = screen.cur.col; |
2127 | oldcursor.col = screen.cur.col; |
2131 | } |
2128 | } |
2132 | } |
2129 | } |
2133 | } |
2130 | } |
2134 | |
2131 | |
2135 | HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); |
|
|
2136 | #if ENABLE_OVERLAY |
|
|
2137 | scr_swap_overlay (); |
|
|
2138 | #endif |
|
|
2139 | |
|
|
2140 | #ifndef NO_SLOW_LINK_SUPPORT |
2132 | #ifndef NO_SLOW_LINK_SUPPORT |
2141 | /* |
2133 | /* |
2142 | * D: CopyArea pass - very useful for slower links |
2134 | * D: CopyArea pass - very useful for slower links |
2143 | * This has been deliberately kept simple. |
2135 | * This has been deliberately kept simple. |
2144 | */ |
2136 | */ |
… | |
… | |
2250 | for (i = 0; ++col < ncol; ) |
2242 | for (i = 0; ++col < ncol; ) |
2251 | { |
2243 | { |
2252 | if (stp[col] == NOCHAR) |
2244 | if (stp[col] == NOCHAR) |
2253 | { |
2245 | { |
2254 | dtp[col] = stp[col]; |
2246 | dtp[col] = stp[col]; |
2255 | drp[col] = rend; |
2247 | drp[col] = srp[col]; |
|
|
2248 | |
2256 | count++; |
2249 | count++; |
2257 | i++; |
2250 | i++; |
2258 | |
2251 | |
2259 | continue; |
2252 | continue; |
2260 | } |
2253 | } |
… | |
… | |
2416 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2409 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2417 | } |
2410 | } |
2418 | } /* for (col....) */ |
2411 | } /* for (col....) */ |
2419 | } /* for (row....) */ |
2412 | } /* for (row....) */ |
2420 | |
2413 | |
2421 | #if ENABLE_OVERLAY |
|
|
2422 | scr_swap_overlay (); |
|
|
2423 | #endif |
|
|
2424 | HOOK_INVOKE ((this, HOOK_REFRESH_END, DT_END)); |
|
|
2425 | |
|
|
2426 | /* |
2414 | /* |
2427 | * G: cleanup cursor and display outline cursor if necessary |
2415 | * G: cleanup cursor and display outline cursor if necessary |
2428 | */ |
2416 | */ |
2429 | if (showcursor) |
2417 | if (showcursor) |
2430 | { |
2418 | { |
… | |
… | |
2468 | } |
2456 | } |
2469 | |
2457 | |
2470 | /* |
2458 | /* |
2471 | * H: cleanup selection |
2459 | * H: cleanup selection |
2472 | */ |
2460 | */ |
|
|
2461 | #if ENABLE_OVERLAY |
|
|
2462 | scr_swap_overlay (); |
|
|
2463 | #endif |
|
|
2464 | HOOK_INVOKE ((this, HOOK_REFRESH_END, DT_END)); |
|
|
2465 | |
2473 | scr_reverse_selection (); |
2466 | scr_reverse_selection (); |
2474 | |
2467 | |
|
|
2468 | screen.flags = old_screen_flags; |
2475 | num_scr = 0; |
2469 | num_scr = 0; |
2476 | num_scr_allow = 1; |
2470 | num_scr_allow = 1; |
2477 | } |
2471 | } |
2478 | |
2472 | |
2479 | void |
2473 | void |
… | |
… | |
3738 | h += 2; min_it (h, nrow); |
3732 | h += 2; min_it (h, nrow); |
3739 | |
3733 | |
3740 | x -= 1; clamp_it (x, 0, ncol - w); |
3734 | x -= 1; clamp_it (x, 0, ncol - w); |
3741 | y -= 1; clamp_it (y, 0, nrow - h); |
3735 | y -= 1; clamp_it (y, 0, nrow - h); |
3742 | |
3736 | |
3743 | ov_x = x; ov_y = y; |
3737 | ov.x = x; ov.y = y; |
3744 | ov_w = w; ov_h = h; |
3738 | ov.w = w; ov.h = h; |
3745 | |
3739 | |
3746 | ov_text = new text_t *[h]; |
3740 | ov.text = new text_t *[h]; |
3747 | ov_rend = new rend_t *[h]; |
3741 | ov.rend = new rend_t *[h]; |
3748 | |
3742 | |
3749 | for (y = 0; y < h; y++) |
3743 | for (y = 0; y < h; y++) |
3750 | { |
3744 | { |
3751 | text_t *tp = ov_text[y] = new text_t[w]; |
3745 | text_t *tp = ov.text[y] = new text_t[w]; |
3752 | rend_t *rp = ov_rend[y] = new rend_t[w]; |
3746 | rend_t *rp = ov.rend[y] = new rend_t[w]; |
3753 | |
3747 | |
3754 | text_t t0, t1, t2; |
3748 | text_t t0, t1, t2; |
3755 | rend_t r = OVERLAY_RSTYLE; |
3749 | rend_t r = OVERLAY_RSTYLE; |
3756 | |
3750 | |
3757 | if (y == 0) |
3751 | if (y == 0) |
… | |
… | |
3776 | } |
3770 | } |
3777 | |
3771 | |
3778 | void |
3772 | void |
3779 | rxvt_term::scr_overlay_off () NOTHROW |
3773 | rxvt_term::scr_overlay_off () NOTHROW |
3780 | { |
3774 | { |
3781 | if (!ov_text) |
3775 | if (!ov.text) |
3782 | return; |
3776 | return; |
3783 | |
3777 | |
3784 | want_refresh = 1; |
3778 | want_refresh = 1; |
3785 | |
3779 | |
3786 | for (int y = 0; y < ov_h; y++) |
3780 | for (int y = 0; y < ov.h; y++) |
3787 | { |
3781 | { |
3788 | delete [] ov_text[y]; |
3782 | delete [] ov.text[y]; |
3789 | delete [] ov_rend[y]; |
3783 | delete [] ov.rend[y]; |
3790 | } |
3784 | } |
3791 | |
3785 | |
3792 | delete [] ov_text; ov_text = 0; |
3786 | delete [] ov.text; ov.text = 0; |
3793 | delete [] ov_rend; ov_rend = 0; |
3787 | delete [] ov.rend; ov.rend = 0; |
3794 | } |
3788 | } |
3795 | |
3789 | |
3796 | void |
3790 | void |
3797 | rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW |
3791 | rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW |
3798 | { |
3792 | { |
3799 | if (!ov_text || x >= ov_w - 2 || y >= ov_h - 2) |
3793 | if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2) |
3800 | return; |
3794 | return; |
3801 | |
3795 | |
3802 | x++, y++; |
3796 | x++, y++; |
3803 | |
3797 | |
3804 | ov_text[y][x] = text; |
3798 | ov.text[y][x] = text; |
3805 | ov_rend[y][x] = rend; |
3799 | ov.rend[y][x] = rend; |
3806 | } |
3800 | } |
3807 | |
3801 | |
3808 | void |
3802 | void |
3809 | rxvt_term::scr_overlay_set (int x, int y, const char *s) NOTHROW |
3803 | rxvt_term::scr_overlay_set (int x, int y, const char *s) NOTHROW |
3810 | { |
3804 | { |
… | |
… | |
3829 | } |
3823 | } |
3830 | |
3824 | |
3831 | void |
3825 | void |
3832 | rxvt_term::scr_swap_overlay () NOTHROW |
3826 | rxvt_term::scr_swap_overlay () NOTHROW |
3833 | { |
3827 | { |
3834 | if (!ov_text) |
3828 | if (!ov.text) |
3835 | return; |
3829 | return; |
3836 | |
3830 | |
|
|
3831 | // hide cursor if it is within the overlay area |
|
|
3832 | if (IN_RANGE_EXC (screen.cur.col - ov.x, 0, ov.w) |
|
|
3833 | && IN_RANGE_EXC (screen.cur.row - ov.y, 0, ov.h)) |
|
|
3834 | screen.flags &= ~Screen_VisibleCursor; |
|
|
3835 | |
3837 | // swap screen mem with overlay |
3836 | // swap screen mem with overlay |
3838 | for (int y = ov_h; y--; ) |
3837 | for (int y = ov.h; y--; ) |
3839 | { |
3838 | { |
3840 | text_t *t1 = ov_text[y]; |
3839 | text_t *t1 = ov.text[y]; |
3841 | rend_t *r1 = ov_rend[y]; |
3840 | rend_t *r1 = ov.rend[y]; |
3842 | |
3841 | |
3843 | text_t *t2 = ROW(y + ov_y + view_start).t + ov_x; |
3842 | text_t *t2 = ROW(y + ov.y + view_start).t + ov.x; |
3844 | rend_t *r2 = ROW(y + ov_y + view_start).r + ov_x; |
3843 | rend_t *r2 = ROW(y + ov.y + view_start).r + ov.x; |
3845 | |
3844 | |
3846 | for (int x = ov_w; x--; ) |
3845 | for (int x = ov.w; x--; ) |
3847 | { |
3846 | { |
3848 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3847 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3849 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |
3848 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |
3850 | } |
3849 | } |
3851 | } |
3850 | } |