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.437 by sf-exg, Mon Mar 25 12:28:04 2013 UTC vs.
Revision 1.441 by sf-exg, Thu Mar 28 09:21:46 2013 UTC

715 715
716 // finally move the view window, if desired 716 // finally move the view window, if desired
717 if (option (Opt_scrollWithBuffer) 717 if (option (Opt_scrollWithBuffer)
718 && view_start != 0 718 && view_start != 0
719 && view_start != -saveLines) 719 && view_start != -saveLines)
720 scr_page (UP, count); 720 scr_page (count);
721 721
722 if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) 722 if (SHOULD_INVOKE (HOOK_SCROLL_BACK))
723 HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, top_row, DT_END)); 723 HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, top_row, DT_END));
724 } 724 }
725 else 725 else
1240 * direction should be UP or DN 1240 * direction should be UP or DN
1241 */ 1241 */
1242void 1242void
1243rxvt_term::scr_index (enum page_dirn direction) NOTHROW 1243rxvt_term::scr_index (enum page_dirn direction) NOTHROW
1244{ 1244{
1245 int dirn;
1246
1247 want_refresh = 1; 1245 want_refresh = 1;
1248 ZERO_SCROLLBACK (); 1246 ZERO_SCROLLBACK ();
1249 1247
1250 dirn = ((direction == UP) ? 1 : -1);
1251
1252 screen.flags &= ~Screen_WrapNext; 1248 screen.flags &= ~Screen_WrapNext;
1253 1249
1254 if ((screen.cur.row == screen.bscroll && direction == UP) 1250 if ((screen.cur.row == screen.bscroll && direction == UP)
1255 || (screen.cur.row == screen.tscroll && direction == DN)) 1251 || (screen.cur.row == screen.tscroll && direction == DN))
1256 scr_scroll_text (screen.tscroll, screen.bscroll, dirn); 1252 scr_scroll_text (screen.tscroll, screen.bscroll, direction);
1257 else 1253 else
1258 screen.cur.row += dirn; 1254 screen.cur.row += direction;
1259 1255
1260 clamp_it (screen.cur.row, 0, nrow - 1); 1256 clamp_it (screen.cur.row, 0, nrow - 1);
1261 selection_check (0); 1257 selection_check (0);
1262} 1258}
1263 1259
1910/* 1906/*
1911 * Page the screen up/down nlines 1907 * Page the screen up/down nlines
1912 * direction should be UP or DN 1908 * direction should be UP or DN
1913 */ 1909 */
1914bool 1910bool
1915rxvt_term::scr_page (enum page_dirn direction, int nlines) NOTHROW 1911rxvt_term::scr_page (int nlines) NOTHROW
1916{ 1912{
1917 int new_view_start =
1918 direction == UP ? view_start - nlines
1919 : view_start + nlines;
1920
1921 return scr_changeview (new_view_start); 1913 return scr_changeview (view_start - nlines);
1922} 1914}
1923 1915
1924bool 1916bool
1925rxvt_term::scr_changeview (int new_view_start) NOTHROW 1917rxvt_term::scr_changeview (int new_view_start) NOTHROW
1926{ 1918{
2048 int i; /* tmp */ 2040 int i; /* tmp */
2049 rend_t ccol1, /* Cursor colour */ 2041 rend_t ccol1, /* Cursor colour */
2050 ccol2; /* Cursor colour2 */ 2042 ccol2; /* Cursor colour2 */
2051 rend_t cur_rend; 2043 rend_t cur_rend;
2052 int cur_col; 2044 int cur_col;
2045 int cursorwidth;
2053 2046
2054 want_refresh = 0; /* screen is current */ 2047 want_refresh = 0; /* screen is current */
2055 2048
2056 if (refresh_type == NO_REFRESH || !mapped) 2049 if (refresh_type == NO_REFRESH || !mapped)
2057 return; 2050 return;
2082 2075
2083 /* 2076 /*
2084 * C: set the cursor character (s) 2077 * C: set the cursor character (s)
2085 */ 2078 */
2086 { 2079 {
2087 bool setoldcursor;
2088
2089#ifdef CURSOR_BLINK 2080#ifdef CURSOR_BLINK
2090 if (hidden_cursor) 2081 if (hidden_cursor)
2091 showcursor = 0; 2082 showcursor = 0;
2092#endif 2083#endif
2093 2084
2095 { 2086 {
2096 int col = screen.cur.col; 2087 int col = screen.cur.col;
2097 2088
2098 while (col && ROW(screen.cur.row).t[col] == NOCHAR) 2089 while (col && ROW(screen.cur.row).t[col] == NOCHAR)
2099 col--; 2090 col--;
2091
2092 cursorwidth = 1;
2093 while (col + cursorwidth < ncol
2094 && ROW(screen.cur.row).t[col + cursorwidth] == NOCHAR)
2095 cursorwidth++;
2100 2096
2101 cur_rend = ROW(screen.cur.row).r[col]; 2097 cur_rend = ROW(screen.cur.row).r[col];
2102 cur_col = col; 2098 cur_col = col;
2103 2099
2104#ifndef NO_CURSORCOLOR 2100#ifndef NO_CURSORCOLOR
2139 scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); 2135 scr_set_char_rend (ROW(screen.cur.row), cur_col, rend);
2140 } 2136 }
2141 } 2137 }
2142 2138
2143 /* make sure no outline cursor is left around */ 2139 /* make sure no outline cursor is left around */
2144 setoldcursor = 0;
2145 if (ocrow != -1) 2140 if (ocrow != -1)
2146 { 2141 {
2147 if (screen.cur.row - view_start != ocrow 2142 if (screen.cur.row - view_start != ocrow
2148 || screen.cur.col != oldcursor.col) 2143 || screen.cur.col != oldcursor.col)
2149 { 2144 {
2150 if (ocrow < nrow 2145 if (ocrow < nrow
2151 && oldcursor.col < ncol) 2146 && oldcursor.col < ncol)
2152 drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); 2147 drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline);
2153
2154 if (focus || !showcursor)
2155 oldcursor.row = -1;
2156 else
2157 setoldcursor = 1;
2158 } 2148 }
2159 } 2149 }
2160 else if (!focus)
2161 setoldcursor = 1;
2162 2150
2163 if (setoldcursor) 2151 // save the current cursor coordinates if the cursor is visible
2152 // and the window is unfocused, so as to clear the outline cursor
2153 // in the next refresh if the cursor moves
2154 if (showcursor && !focus && screen.cur.row - view_start < nrow)
2164 { 2155 {
2165 if (screen.cur.row - view_start >= nrow)
2166 oldcursor.row = -1;
2167 else
2168 {
2169 oldcursor.row = screen.cur.row - view_start; 2156 oldcursor.row = screen.cur.row - view_start;
2170 oldcursor.col = screen.cur.col; 2157 oldcursor.col = screen.cur.col;
2171 }
2172 } 2158 }
2159 else
2160 oldcursor.row = -1;
2173 } 2161 }
2174 2162
2175#ifndef NO_SLOW_LINK_SUPPORT 2163#ifndef NO_SLOW_LINK_SUPPORT
2176 /* 2164 /*
2177 * D: CopyArea pass - very useful for slower links 2165 * D: CopyArea pass - very useful for slower links
2443 else 2431 else
2444 font->draw (*drawable, xpixel, ypixel, text, count, fore, back); 2432 font->draw (*drawable, xpixel, ypixel, text, count, fore, back);
2445 2433
2446 if (ecb_unlikely (rend & RS_Uline && font->descent > 1 && fore != back)) 2434 if (ecb_unlikely (rend & RS_Uline && font->descent > 1 && fore != back))
2447 { 2435 {
2436 if (showcursor && focus && row == screen.cur.row
2437 && IN_RANGE_EXC (col, cur_col, cur_col + cursorwidth))
2438 XSetForeground (dpy, gc, pix_colors[ccol1]);
2439 else
2448#if ENABLE_FRILLS 2440#if ENABLE_FRILLS
2449 if (ISSET_PIXCOLOR (Color_underline)) 2441 if (ISSET_PIXCOLOR (Color_underline))
2450 XSetForeground (dpy, gc, pix_colors[Color_underline]); 2442 XSetForeground (dpy, gc, pix_colors[Color_underline]);
2451 else 2443 else
2452#endif 2444#endif
2466 { 2458 {
2467 if (focus) 2459 if (focus)
2468 scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); 2460 scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend);
2469 else if (oldcursor.row >= 0) 2461 else if (oldcursor.row >= 0)
2470 { 2462 {
2471 int cursorwidth = 1;
2472 int col = oldcursor.col;
2473
2474 while (col && ROW(screen.cur.row).t[col] == NOCHAR)
2475 col--;
2476
2477 while (col + cursorwidth < ncol
2478 && drawn_buf[oldcursor.row].t[col + cursorwidth] == NOCHAR)
2479 cursorwidth++;
2480
2481 XSetForeground (dpy, gc, pix_colors[ccol1]); 2463 XSetForeground (dpy, gc, pix_colors[ccol1]);
2482 2464
2483 XDrawRectangle (dpy, vt, gc, 2465 XDrawRectangle (dpy, vt, gc,
2484 Col2Pixel (col), 2466 Col2Pixel (cur_col),
2485 Row2Pixel (oldcursor.row), 2467 Row2Pixel (oldcursor.row),
2486 (unsigned int) (Width2Pixel (cursorwidth) - 1), 2468 (unsigned int) (Width2Pixel (cursorwidth) - 1),
2487 (unsigned int) (Height2Pixel (1) - 1)); 2469 (unsigned int) (Height2Pixel (1) - 1));
2488 } 2470 }
2489 } 2471 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines