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.440 by root, Wed Mar 27 17:24:16 2013 UTC vs.
Revision 1.451 by mikachu, Sat Dec 6 09:36:12 2014 UTC

5 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> 5 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com>
6 * Copyright (c) 2003-2007 Marc Lehmann <schmorp@schmorp.de> 6 * Copyright (c) 2003-2007 Marc Lehmann <schmorp@schmorp.de>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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
1901 * the top of the screen 1897 * the top of the screen
1902 */ 1898 */
1903void 1899void
1904rxvt_term::scr_move_to (int y, int len) NOTHROW 1900rxvt_term::scr_move_to (int y, int len) NOTHROW
1905{ 1901{
1906 scr_changeview ((top_row - nrow) * (len - y) / len + (nrow - 1)); 1902 // lerp (y, 0, len, top_row, nrow - 1)
1903 scr_changeview (top_row + (nrow - 1 - top_row) * y / len);
1907} 1904}
1908 1905
1909/* ------------------------------------------------------------------------- */ 1906/* ------------------------------------------------------------------------- */
1910/* 1907/*
1911 * Page the screen up/down nlines 1908 * Page the screen up/down nlines
2121 ccol2 = bgcolor_of (rstyle); 2118 ccol2 = bgcolor_of (rstyle);
2122#else 2119#else
2123 ccol2 = Color_bg; 2120 ccol2 = Color_bg;
2124#endif 2121#endif
2125 2122
2126 if (focus) 2123 if (focus && cursor_type != 2)
2127 { 2124 {
2128 rend_t rend = cur_rend; 2125 rend_t rend = cur_rend;
2129 2126
2130 if (option (Opt_cursorUnderline)) 2127 if (cursor_type == 1)
2131 rend ^= RS_Uline; 2128 rend ^= RS_Uline;
2132 else 2129 else
2133 { 2130 {
2134 rend ^= RS_RVid; 2131 rend ^= RS_RVid;
2135 rend = SET_FGCOLOR (rend, ccol1); 2132 rend = SET_FGCOLOR (rend, ccol1);
2142 2139
2143 /* make sure no outline cursor is left around */ 2140 /* make sure no outline cursor is left around */
2144 if (ocrow != -1) 2141 if (ocrow != -1)
2145 { 2142 {
2146 if (screen.cur.row - view_start != ocrow 2143 if (screen.cur.row - view_start != ocrow
2147 || screen.cur.col != oldcursor.col) 2144 || screen.cur.col != oldcursor.col || !showcursor)
2148 { 2145 {
2149 if (ocrow < nrow 2146 if (ocrow < nrow
2150 && oldcursor.col < ncol) 2147 && oldcursor.col < ncol)
2151 drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); 2148 drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline);
2152 } 2149 }
2153 } 2150 }
2154 2151
2155 // save the current cursor coordinates if the cursor is visible 2152 // save the current cursor coordinates if the cursor is visible
2156 // and the window is unfocused, so as to clear the outline cursor 2153 // and either the window is unfocused or the cursor style is
2157 // in the next refresh if the cursor moves 2154 // vertical bar, so as to clear the outline cursor in the next
2155 // refresh if the cursor moves or becomes invisible
2158 if (showcursor && !focus && screen.cur.row - view_start < nrow) 2156 if (showcursor && (!focus || cursor_type == 2) && screen.cur.row - view_start < nrow)
2159 { 2157 {
2160 oldcursor.row = screen.cur.row - view_start; 2158 oldcursor.row = screen.cur.row - view_start;
2161 oldcursor.col = screen.cur.col; 2159 oldcursor.col = screen.cur.col;
2162 } 2160 }
2163 else 2161 else
2250 int ypixel = (int)Row2Pixel (row); 2248 int ypixel = (int)Row2Pixel (row);
2251 2249
2252 for (col = 0; col < ncol; col++) 2250 for (col = 0; col < ncol; col++)
2253 { 2251 {
2254 /* compare new text with old - if exactly the same then continue */ 2252 /* compare new text with old - if exactly the same then continue */
2255 if (stp[col] == dtp[col] /* Must match characters to skip. */ 2253 if (stp[col] == dtp[col] && RS_SAME (srp[col], drp[col]))
2256 && (RS_SAME (srp[col], drp[col]) /* Either rendition the same or */
2257 || (stp[col] == ' ' /* space w/ no background change */
2258 && GET_BGATTR (srp[col]) == GET_BGATTR (drp[col]))))
2259 continue; 2254 continue;
2260 2255
2261 // redraw one or more characters 2256 // redraw one or more characters
2262 2257
2263 // seek to the beginning of wide characters 2258 // seek to the beginning of wide characters
2459 * G: cleanup cursor and display outline cursor if necessary 2454 * G: cleanup cursor and display outline cursor if necessary
2460 */ 2455 */
2461 if (showcursor) 2456 if (showcursor)
2462 { 2457 {
2463 if (focus) 2458 if (focus)
2459 {
2460 if (cursor_type != 2)
2464 scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); 2461 scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend);
2462 else if (oldcursor.row >= 0)
2463 {
2464 XSetForeground (dpy, gc, pix_colors[ccol1]);
2465 XFillRectangle (dpy, vt, gc,
2466 Col2Pixel (cur_col),
2467 Row2Pixel (oldcursor.row),
2468 1,
2469 Height2Pixel (1));
2470 }
2471 }
2465 else if (oldcursor.row >= 0) 2472 else if (oldcursor.row >= 0)
2466 { 2473 {
2467 XSetForeground (dpy, gc, pix_colors[ccol1]); 2474 XSetForeground (dpy, gc, pix_colors[ccol1]);
2468 2475
2469 XDrawRectangle (dpy, vt, gc, 2476 XDrawRectangle (dpy, vt, gc,
2544 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); 2551 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
2545 } 2552 }
2546 2553
2547 XClearWindow (dpy, parent); 2554 XClearWindow (dpy, parent);
2548 2555
2549 if (scrollBar.win) 2556 if (scrollBar.state && scrollBar.win)
2550 { 2557 {
2551 if (transparent) 2558 if (transparent)
2552 XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); 2559 XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative);
2553 else 2560 else
2554 XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); 2561 XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]);
2682 2689
2683void 2690void
2684rxvt_term::selection_changed () NOTHROW 2691rxvt_term::selection_changed () NOTHROW
2685{ 2692{
2686 line_t &r1 = ROW (selection.beg.row); 2693 line_t &r1 = ROW (selection.beg.row);
2687 while (selection.beg.col > 0 && r1.t [selection.beg.col] == NOCHAR) 2694 while (selection.beg.col < r1.l && r1.t [selection.beg.col] == NOCHAR)
2688 --selection.beg.col; 2695 ++selection.beg.col;
2689 2696
2690 line_t &r2 = ROW (selection.end.row); 2697 line_t &r2 = ROW (selection.end.row);
2691 while (selection.end.col < r2.l && r2.t [selection.end.col] == NOCHAR) 2698 while (selection.end.col < r2.l && r2.t [selection.end.col] == NOCHAR)
2692 ++selection.end.col; 2699 ++selection.end.col;
2693 2700

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines