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.435 by sf-exg, Sun Mar 24 10:12:04 2013 UTC vs.
Revision 1.442 by sf-exg, Sat Mar 30 08:47:06 2013 UTC

254 254
255 scr_alloc (); 255 scr_alloc ();
256 256
257 if (!prev_row_buf) 257 if (!prev_row_buf)
258 { 258 {
259 /*
260 * first time called (or after scr_release) so just malloc everything: don't rely on realloc
261 */
262 top_row = 0; 259 top_row = 0;
263 term_start = 0; 260 term_start = 0;
264 261
265 memset (charsets, 'B', sizeof (charsets)); 262 memset (charsets, 'B', sizeof (charsets));
266 rstyle = DEFAULT_RSTYLE; 263 rstyle = DEFAULT_RSTYLE;
718 715
719 // finally move the view window, if desired 716 // finally move the view window, if desired
720 if (option (Opt_scrollWithBuffer) 717 if (option (Opt_scrollWithBuffer)
721 && view_start != 0 718 && view_start != 0
722 && view_start != -saveLines) 719 && view_start != -saveLines)
723 scr_page (UP, count); 720 scr_page (count);
724 721
725 if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) 722 if (SHOULD_INVOKE (HOOK_SCROLL_BACK))
726 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));
727 } 724 }
728 else 725 else
1243 * direction should be UP or DN 1240 * direction should be UP or DN
1244 */ 1241 */
1245void 1242void
1246rxvt_term::scr_index (enum page_dirn direction) NOTHROW 1243rxvt_term::scr_index (enum page_dirn direction) NOTHROW
1247{ 1244{
1248 int dirn;
1249
1250 want_refresh = 1; 1245 want_refresh = 1;
1251 ZERO_SCROLLBACK (); 1246 ZERO_SCROLLBACK ();
1252 1247
1253 dirn = ((direction == UP) ? 1 : -1);
1254
1255 screen.flags &= ~Screen_WrapNext; 1248 screen.flags &= ~Screen_WrapNext;
1256 1249
1257 if ((screen.cur.row == screen.bscroll && direction == UP) 1250 if ((screen.cur.row == screen.bscroll && direction == UP)
1258 || (screen.cur.row == screen.tscroll && direction == DN)) 1251 || (screen.cur.row == screen.tscroll && direction == DN))
1259 scr_scroll_text (screen.tscroll, screen.bscroll, dirn); 1252 scr_scroll_text (screen.tscroll, screen.bscroll, direction);
1260 else 1253 else
1261 screen.cur.row += dirn; 1254 screen.cur.row += direction;
1262 1255
1263 clamp_it (screen.cur.row, 0, nrow - 1); 1256 clamp_it (screen.cur.row, 0, nrow - 1);
1264 selection_check (0); 1257 selection_check (0);
1265} 1258}
1266 1259
1913/* 1906/*
1914 * Page the screen up/down nlines 1907 * Page the screen up/down nlines
1915 * direction should be UP or DN 1908 * direction should be UP or DN
1916 */ 1909 */
1917bool 1910bool
1918rxvt_term::scr_page (enum page_dirn direction, int nlines) NOTHROW 1911rxvt_term::scr_page (int nlines) NOTHROW
1919{ 1912{
1920 int new_view_start =
1921 direction == UP ? view_start - nlines
1922 : view_start + nlines;
1923
1924 return scr_changeview (new_view_start); 1913 return scr_changeview (view_start - nlines);
1925} 1914}
1926 1915
1927bool 1916bool
1928rxvt_term::scr_changeview (int new_view_start) NOTHROW 1917rxvt_term::scr_changeview (int new_view_start) NOTHROW
1929{ 1918{
2051 int i; /* tmp */ 2040 int i; /* tmp */
2052 rend_t ccol1, /* Cursor colour */ 2041 rend_t ccol1, /* Cursor colour */
2053 ccol2; /* Cursor colour2 */ 2042 ccol2; /* Cursor colour2 */
2054 rend_t cur_rend; 2043 rend_t cur_rend;
2055 int cur_col; 2044 int cur_col;
2045 int cursorwidth;
2056 2046
2057 want_refresh = 0; /* screen is current */ 2047 want_refresh = 0; /* screen is current */
2058 2048
2059 if (refresh_type == NO_REFRESH || !mapped) 2049 if (refresh_type == NO_REFRESH || !mapped)
2060 return; 2050 return;
2085 2075
2086 /* 2076 /*
2087 * C: set the cursor character (s) 2077 * C: set the cursor character (s)
2088 */ 2078 */
2089 { 2079 {
2090 bool setoldcursor;
2091
2092#ifdef CURSOR_BLINK 2080#ifdef CURSOR_BLINK
2093 if (hidden_cursor) 2081 if (hidden_cursor)
2094 showcursor = 0; 2082 showcursor = 0;
2095#endif 2083#endif
2096 2084
2098 { 2086 {
2099 int col = screen.cur.col; 2087 int col = screen.cur.col;
2100 2088
2101 while (col && ROW(screen.cur.row).t[col] == NOCHAR) 2089 while (col && ROW(screen.cur.row).t[col] == NOCHAR)
2102 col--; 2090 col--;
2091
2092 cursorwidth = 1;
2093 while (col + cursorwidth < ncol
2094 && ROW(screen.cur.row).t[col + cursorwidth] == NOCHAR)
2095 cursorwidth++;
2103 2096
2104 cur_rend = ROW(screen.cur.row).r[col]; 2097 cur_rend = ROW(screen.cur.row).r[col];
2105 cur_col = col; 2098 cur_col = col;
2106 2099
2107#ifndef NO_CURSORCOLOR 2100#ifndef NO_CURSORCOLOR
2142 scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); 2135 scr_set_char_rend (ROW(screen.cur.row), cur_col, rend);
2143 } 2136 }
2144 } 2137 }
2145 2138
2146 /* make sure no outline cursor is left around */ 2139 /* make sure no outline cursor is left around */
2147 setoldcursor = 0;
2148 if (ocrow != -1) 2140 if (ocrow != -1)
2149 { 2141 {
2150 if (screen.cur.row - view_start != ocrow 2142 if (screen.cur.row - view_start != ocrow
2151 || screen.cur.col != oldcursor.col) 2143 || screen.cur.col != oldcursor.col)
2152 { 2144 {
2153 if (ocrow < nrow 2145 if (ocrow < nrow
2154 && oldcursor.col < ncol) 2146 && oldcursor.col < ncol)
2155 drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); 2147 drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline);
2156
2157 if (focus || !showcursor)
2158 oldcursor.row = -1;
2159 else
2160 setoldcursor = 1;
2161 } 2148 }
2162 } 2149 }
2163 else if (!focus)
2164 setoldcursor = 1;
2165 2150
2166 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)
2167 { 2155 {
2168 if (screen.cur.row - view_start >= nrow)
2169 oldcursor.row = -1;
2170 else
2171 {
2172 oldcursor.row = screen.cur.row - view_start; 2156 oldcursor.row = screen.cur.row - view_start;
2173 oldcursor.col = screen.cur.col; 2157 oldcursor.col = screen.cur.col;
2174 }
2175 } 2158 }
2159 else
2160 oldcursor.row = -1;
2176 } 2161 }
2177 2162
2178#ifndef NO_SLOW_LINK_SUPPORT 2163#ifndef NO_SLOW_LINK_SUPPORT
2179 /* 2164 /*
2180 * D: CopyArea pass - very useful for slower links 2165 * D: CopyArea pass - very useful for slower links
2446 else 2431 else
2447 font->draw (*drawable, xpixel, ypixel, text, count, fore, back); 2432 font->draw (*drawable, xpixel, ypixel, text, count, fore, back);
2448 2433
2449 if (ecb_unlikely (rend & RS_Uline && font->descent > 1 && fore != back)) 2434 if (ecb_unlikely (rend & RS_Uline && font->descent > 1 && fore != back))
2450 { 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
2451#if ENABLE_FRILLS 2440#if ENABLE_FRILLS
2452 if (ISSET_PIXCOLOR (Color_underline)) 2441 if (ISSET_PIXCOLOR (Color_underline))
2453 XSetForeground (dpy, gc, pix_colors[Color_underline]); 2442 XSetForeground (dpy, gc, pix_colors[Color_underline]);
2454 else 2443 else
2455#endif 2444#endif
2469 { 2458 {
2470 if (focus) 2459 if (focus)
2471 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);
2472 else if (oldcursor.row >= 0) 2461 else if (oldcursor.row >= 0)
2473 { 2462 {
2474 int cursorwidth = 1;
2475 int col = oldcursor.col;
2476
2477 while (col && ROW(screen.cur.row).t[col] == NOCHAR)
2478 col--;
2479
2480 while (col + cursorwidth < ncol
2481 && drawn_buf[oldcursor.row].t[col + cursorwidth] == NOCHAR)
2482 cursorwidth++;
2483
2484#ifndef NO_CURSORCOLOR
2485 if (ISSET_PIXCOLOR (Color_cursor))
2486 XSetForeground (dpy, gc, pix_colors[Color_cursor]);
2487 else
2488#endif
2489 XSetForeground (dpy, gc, pix_colors[ccol1]); 2463 XSetForeground (dpy, gc, pix_colors[ccol1]);
2490 2464
2491 XDrawRectangle (dpy, vt, gc, 2465 XDrawRectangle (dpy, vt, gc,
2492 Col2Pixel (col), 2466 Col2Pixel (cur_col),
2493 Row2Pixel (oldcursor.row), 2467 Row2Pixel (oldcursor.row),
2494 (unsigned int) (Width2Pixel (cursorwidth) - 1), 2468 (unsigned int) (Width2Pixel (cursorwidth) - 1),
2495 (unsigned int) (Height2Pixel (1) - 1)); 2469 (unsigned int) (Height2Pixel (1) - 1));
2496 } 2470 }
2497 } 2471 }
3098 break; 3072 break;
3099 } 3073 }
3100 3074
3101 if (dirn == DN) 3075 if (dirn == DN)
3102 col++; /* put us on one past the end */ 3076 col++; /* put us on one past the end */
3077 else
3078 {
3079 // if the delimiter on the left has width > 1 col points to the
3080 // first NOCHAR in the delimiter cell and so we must move it to the
3081 // beginning of the next cell.
3082 while (ROW(row).t[col] == NOCHAR)
3083 col++;
3084 }
3103 3085
3104 /* Poke the values back in */ 3086 /* Poke the values back in */
3105 ret->row = row; 3087 ret->row = row;
3106 ret->col = col; 3088 ret->col = col;
3107} 3089}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines