ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/screen.C
(Generate patch)

Comparing rxvt-unicode/src/screen.C (file contents):
Revision 1.325 by root, Wed Nov 5 12:28:15 2008 UTC vs.
Revision 1.331 by sf-exg, Wed Jan 6 17:52:43 2010 UTC

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 {
394 392
395 clamp_it (screen.cur.row, 0, nrow - 1); 393 clamp_it (screen.cur.row, 0, nrow - 1);
396 clamp_it (screen.cur.col, 0, ncol - 1); 394 clamp_it (screen.cur.col, 0, ncol - 1);
397 } 395 }
398 396
397 free (tabs);
398 tabs = (char *)rxvt_malloc (ncol);
399
400 for (int col = ncol; --col; )
401 tabs [col] = col % TABSIZE == 0;
402
399 CLEAR_ALL_SELECTION (); 403 CLEAR_ALL_SELECTION ();
400 404
401 prev_nrow = nrow; 405 prev_nrow = nrow;
402 prev_ncol = ncol; 406 prev_ncol = ncol;
403 407
453 scr_overlay_off (); 457 scr_overlay_off ();
454#endif 458#endif
455 459
456 if (current_screen != PRIMARY) 460 if (current_screen != PRIMARY)
457 scr_swap_screen (); 461 scr_swap_screen ();
458
459 free (tabs);
460 tabs = (char *)rxvt_malloc (ncol);
461
462 for (int col = ncol; --col; )
463 tabs [col] = col % TABSIZE == 0;
464 462
465 scr_scroll_region (0, MAX_ROWS - 1); 463 scr_scroll_region (0, MAX_ROWS - 1);
466 scr_rendition (0, ~RS_None); 464 scr_rendition (0, ~RS_None);
467 scr_insert_mode (0); 465 scr_insert_mode (0);
468} 466}
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
521void 517void
522rxvt_term::scr_swap_screen () 518rxvt_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
1941 1933
1942 bell_ev.start (VISUAL_BELL_DURATION); 1934 bell_ev.start (VISUAL_BELL_DURATION);
1943 } 1935 }
1944 else 1936 else
1945 XBell (dpy, 0); 1937 XBell (dpy, 0);
1938 HOOK_INVOKE ((this, HOOK_BELL, DT_END));
1946#endif 1939#endif
1947} 1940}
1948 1941
1949/* ------------------------------------------------------------------------- */ 1942/* ------------------------------------------------------------------------- */
1950/* ARGSUSED */ 1943/* ARGSUSED */
1969 row_start = view_start; 1962 row_start = view_start;
1970 } 1963 }
1971 1964
1972 wctomb (0, 0); 1965 wctomb (0, 0);
1973 1966
1974 for (int r1 = 0; r1 < nrows; r1++) 1967 for (int r1 = row_start; r1 < row_start + nrows; r1++)
1975 { 1968 {
1976 text_t *tp = ROW(r1).t; 1969 text_t *tp = ROW(r1).t;
1977 int len = ROW(r1).l; 1970 int len = ROW(r1).l;
1978 1971
1979 for (int i = len >= 0 ? len : ncol - 1; i--; ) //TODO//FIXME//LEN 1972 for (int i = len >= 0 ? len : ncol - 1; i--; ) //TODO//FIXME//LEN
2008 * screen.text/screen.rend contain what the screen will change to. 2001 * screen.text/screen.rend contain what the screen will change to.
2009 */ 2002 */
2010void 2003void
2011rxvt_term::scr_refresh () NOTHROW 2004rxvt_term::scr_refresh () NOTHROW
2012{ 2005{
2013 unsigned char have_bg,
2014 showcursor; /* show the cursor */
2015 int16_t col, row, /* column/row we're processing */ 2006 int16_t col, row, /* column/row we're processing */
2016 ocrow; /* old cursor row */ 2007 ocrow; /* old cursor row */
2017 int i; /* tmp */ 2008 int i; /* tmp */
2018#ifndef NO_CURSORCOLOR 2009#ifndef NO_CURSORCOLOR
2019 rend_t cc1; /* store colours at cursor position (s) */ 2010 rend_t cc1; /* store colours at cursor position (s) */
2030 /* 2021 /*
2031 * A: set up vars 2022 * A: set up vars
2032 */ 2023 */
2033 refresh_count = 0; 2024 refresh_count = 0;
2034 2025
2026 unsigned int old_screen_flags = screen.flags;
2035 have_bg = 0; 2027 char have_bg = 0;
2036#ifdef HAVE_BG_PIXMAP 2028#ifdef HAVE_BG_PIXMAP
2037 have_bg = bgPixmap.pixmap != None; 2029 have_bg = bgPixmap.pixmap != None;
2038#endif 2030#endif
2039 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 2031 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
2040 2032
2041 /* 2033 /*
2042 * B: reverse any characters which are selected 2034 * B: reverse any characters which are selected
2043 */ 2035 */
2044 scr_reverse_selection (); 2036 scr_reverse_selection ();
2037
2038 HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END));
2039#if ENABLE_OVERLAY
2040 scr_swap_overlay ();
2041#endif
2042
2043 char showcursor = screen.flags & Screen_VisibleCursor;
2045 2044
2046 /* 2045 /*
2047 * C: set the cursor character (s) 2046 * C: set the cursor character (s)
2048 */ 2047 */
2049 { 2048 {
2050 unsigned char setoldcursor; 2049 unsigned char setoldcursor;
2051 2050
2052 showcursor = (screen.flags & Screen_VisibleCursor);
2053#ifdef CURSOR_BLINK 2051#ifdef CURSOR_BLINK
2054 if (hidden_cursor) 2052 if (hidden_cursor)
2055 showcursor = 0; 2053 showcursor = 0;
2056#endif 2054#endif
2057 2055
2130 oldcursor.col = screen.cur.col; 2128 oldcursor.col = screen.cur.col;
2131 } 2129 }
2132 } 2130 }
2133 } 2131 }
2134 2132
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 2133#ifndef NO_SLOW_LINK_SUPPORT
2141 /* 2134 /*
2142 * D: CopyArea pass - very useful for slower links 2135 * D: CopyArea pass - very useful for slower links
2143 * This has been deliberately kept simple. 2136 * This has been deliberately kept simple.
2144 */ 2137 */
2250 for (i = 0; ++col < ncol; ) 2243 for (i = 0; ++col < ncol; )
2251 { 2244 {
2252 if (stp[col] == NOCHAR) 2245 if (stp[col] == NOCHAR)
2253 { 2246 {
2254 dtp[col] = stp[col]; 2247 dtp[col] = stp[col];
2255 drp[col] = rend; 2248 drp[col] = srp[col];
2249
2256 count++; 2250 count++;
2257 i++; 2251 i++;
2258 2252
2259 continue; 2253 continue;
2260 } 2254 }
2416 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); 2410 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1);
2417 } 2411 }
2418 } /* for (col....) */ 2412 } /* for (col....) */
2419 } /* for (row....) */ 2413 } /* for (row....) */
2420 2414
2421#if ENABLE_OVERLAY
2422 scr_swap_overlay ();
2423#endif
2424 HOOK_INVOKE ((this, HOOK_REFRESH_END, DT_END));
2425
2426 /* 2415 /*
2427 * G: cleanup cursor and display outline cursor if necessary 2416 * G: cleanup cursor and display outline cursor if necessary
2428 */ 2417 */
2429 if (showcursor) 2418 if (showcursor)
2430 { 2419 {
2468 } 2457 }
2469 2458
2470 /* 2459 /*
2471 * H: cleanup selection 2460 * H: cleanup selection
2472 */ 2461 */
2462#if ENABLE_OVERLAY
2463 scr_swap_overlay ();
2464#endif
2465 HOOK_INVOKE ((this, HOOK_REFRESH_END, DT_END));
2466
2473 scr_reverse_selection (); 2467 scr_reverse_selection ();
2474 2468
2469 screen.flags = old_screen_flags;
2475 num_scr = 0; 2470 num_scr = 0;
2476 num_scr_allow = 1; 2471 num_scr_allow = 1;
2477} 2472}
2478 2473
2479void 2474void
3738 h += 2; min_it (h, nrow); 3733 h += 2; min_it (h, nrow);
3739 3734
3740 x -= 1; clamp_it (x, 0, ncol - w); 3735 x -= 1; clamp_it (x, 0, ncol - w);
3741 y -= 1; clamp_it (y, 0, nrow - h); 3736 y -= 1; clamp_it (y, 0, nrow - h);
3742 3737
3743 ov_x = x; ov_y = y; 3738 ov.x = x; ov.y = y;
3744 ov_w = w; ov_h = h; 3739 ov.w = w; ov.h = h;
3745 3740
3746 ov_text = new text_t *[h]; 3741 ov.text = new text_t *[h];
3747 ov_rend = new rend_t *[h]; 3742 ov.rend = new rend_t *[h];
3748 3743
3749 for (y = 0; y < h; y++) 3744 for (y = 0; y < h; y++)
3750 { 3745 {
3751 text_t *tp = ov_text[y] = new text_t[w]; 3746 text_t *tp = ov.text[y] = new text_t[w];
3752 rend_t *rp = ov_rend[y] = new rend_t[w]; 3747 rend_t *rp = ov.rend[y] = new rend_t[w];
3753 3748
3754 text_t t0, t1, t2; 3749 text_t t0, t1, t2;
3755 rend_t r = OVERLAY_RSTYLE; 3750 rend_t r = OVERLAY_RSTYLE;
3756 3751
3757 if (y == 0) 3752 if (y == 0)
3776} 3771}
3777 3772
3778void 3773void
3779rxvt_term::scr_overlay_off () NOTHROW 3774rxvt_term::scr_overlay_off () NOTHROW
3780{ 3775{
3781 if (!ov_text) 3776 if (!ov.text)
3782 return; 3777 return;
3783 3778
3784 want_refresh = 1; 3779 want_refresh = 1;
3785 3780
3786 for (int y = 0; y < ov_h; y++) 3781 for (int y = 0; y < ov.h; y++)
3787 { 3782 {
3788 delete [] ov_text[y]; 3783 delete [] ov.text[y];
3789 delete [] ov_rend[y]; 3784 delete [] ov.rend[y];
3790 } 3785 }
3791 3786
3792 delete [] ov_text; ov_text = 0; 3787 delete [] ov.text; ov.text = 0;
3793 delete [] ov_rend; ov_rend = 0; 3788 delete [] ov.rend; ov.rend = 0;
3794} 3789}
3795 3790
3796void 3791void
3797rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW 3792rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW
3798{ 3793{
3799 if (!ov_text || x >= ov_w - 2 || y >= ov_h - 2) 3794 if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2)
3800 return; 3795 return;
3801 3796
3802 x++, y++; 3797 x++, y++;
3803 3798
3804 ov_text[y][x] = text; 3799 ov.text[y][x] = text;
3805 ov_rend[y][x] = rend; 3800 ov.rend[y][x] = rend;
3806} 3801}
3807 3802
3808void 3803void
3809rxvt_term::scr_overlay_set (int x, int y, const char *s) NOTHROW 3804rxvt_term::scr_overlay_set (int x, int y, const char *s) NOTHROW
3810{ 3805{
3829} 3824}
3830 3825
3831void 3826void
3832rxvt_term::scr_swap_overlay () NOTHROW 3827rxvt_term::scr_swap_overlay () NOTHROW
3833{ 3828{
3834 if (!ov_text) 3829 if (!ov.text)
3835 return; 3830 return;
3836 3831
3832 // hide cursor if it is within the overlay area
3833 if (IN_RANGE_EXC (screen.cur.col - ov.x, 0, ov.w)
3834 && IN_RANGE_EXC (screen.cur.row - ov.y, 0, ov.h))
3835 screen.flags &= ~Screen_VisibleCursor;
3836
3837 // swap screen mem with overlay 3837 // swap screen mem with overlay
3838 for (int y = ov_h; y--; ) 3838 for (int y = ov.h; y--; )
3839 { 3839 {
3840 text_t *t1 = ov_text[y]; 3840 text_t *t1 = ov.text[y];
3841 rend_t *r1 = ov_rend[y]; 3841 rend_t *r1 = ov.rend[y];
3842 3842
3843 text_t *t2 = ROW(y + ov_y + view_start).t + ov_x; 3843 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; 3844 rend_t *r2 = ROW(y + ov.y + view_start).r + ov.x;
3845 3845
3846 for (int x = ov_w; x--; ) 3846 for (int x = ov.w; x--; )
3847 { 3847 {
3848 text_t t = *t1; *t1++ = *t2; *t2++ = t; 3848 text_t t = *t1; *t1++ = *t2; *t2++ = t;
3849 rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); 3849 rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t));
3850 } 3850 }
3851 } 3851 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines