… | |
… | |
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 |
… | |
… | |
1897 | * the top of the screen |
1897 | * the top of the screen |
1898 | */ |
1898 | */ |
1899 | void |
1899 | void |
1900 | rxvt_term::scr_move_to (int y, int len) NOTHROW |
1900 | rxvt_term::scr_move_to (int y, int len) NOTHROW |
1901 | { |
1901 | { |
1902 | 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); |
1903 | } |
1904 | } |
1904 | |
1905 | |
1905 | /* ------------------------------------------------------------------------- */ |
1906 | /* ------------------------------------------------------------------------- */ |
1906 | /* |
1907 | /* |
1907 | * Page the screen up/down nlines |
1908 | * Page the screen up/down nlines |
… | |
… | |
2117 | ccol2 = bgcolor_of (rstyle); |
2118 | ccol2 = bgcolor_of (rstyle); |
2118 | #else |
2119 | #else |
2119 | ccol2 = Color_bg; |
2120 | ccol2 = Color_bg; |
2120 | #endif |
2121 | #endif |
2121 | |
2122 | |
2122 | if (focus) |
2123 | if (focus && cursor_type != 2) |
2123 | { |
2124 | { |
2124 | rend_t rend = cur_rend; |
2125 | rend_t rend = cur_rend; |
2125 | |
2126 | |
2126 | if (option (Opt_cursorUnderline)) |
2127 | if (cursor_type == 1) |
2127 | rend ^= RS_Uline; |
2128 | rend ^= RS_Uline; |
2128 | else |
2129 | else |
2129 | { |
2130 | { |
2130 | rend ^= RS_RVid; |
2131 | rend ^= RS_RVid; |
2131 | rend = SET_FGCOLOR (rend, ccol1); |
2132 | rend = SET_FGCOLOR (rend, ccol1); |
… | |
… | |
2138 | |
2139 | |
2139 | /* make sure no outline cursor is left around */ |
2140 | /* make sure no outline cursor is left around */ |
2140 | if (ocrow != -1) |
2141 | if (ocrow != -1) |
2141 | { |
2142 | { |
2142 | if (screen.cur.row - view_start != ocrow |
2143 | if (screen.cur.row - view_start != ocrow |
2143 | || screen.cur.col != oldcursor.col) |
2144 | || screen.cur.col != oldcursor.col || !showcursor) |
2144 | { |
2145 | { |
2145 | if (ocrow < nrow |
2146 | if (ocrow < nrow |
2146 | && oldcursor.col < ncol) |
2147 | && oldcursor.col < ncol) |
2147 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
2148 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
2148 | } |
2149 | } |
2149 | } |
2150 | } |
2150 | |
2151 | |
2151 | // save the current cursor coordinates if the cursor is visible |
2152 | // save the current cursor coordinates if the cursor is visible |
2152 | // and the window is unfocused, so as to clear the outline cursor |
2153 | // and either the window is unfocused or the cursor style is |
2153 | // 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 |
2154 | if (showcursor && !focus && screen.cur.row - view_start < nrow) |
2156 | if (showcursor && (!focus || cursor_type == 2) && screen.cur.row - view_start < nrow) |
2155 | { |
2157 | { |
2156 | oldcursor.row = screen.cur.row - view_start; |
2158 | oldcursor.row = screen.cur.row - view_start; |
2157 | oldcursor.col = screen.cur.col; |
2159 | oldcursor.col = screen.cur.col; |
2158 | } |
2160 | } |
2159 | else |
2161 | else |
… | |
… | |
2455 | * G: cleanup cursor and display outline cursor if necessary |
2457 | * G: cleanup cursor and display outline cursor if necessary |
2456 | */ |
2458 | */ |
2457 | if (showcursor) |
2459 | if (showcursor) |
2458 | { |
2460 | { |
2459 | if (focus) |
2461 | if (focus) |
|
|
2462 | { |
|
|
2463 | if (cursor_type != 2) |
2460 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
2464 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
|
|
2465 | else if (oldcursor.row >= 0) |
|
|
2466 | { |
|
|
2467 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
|
|
2468 | XFillRectangle (dpy, vt, gc, |
|
|
2469 | Col2Pixel (cur_col), |
|
|
2470 | Row2Pixel (oldcursor.row), |
|
|
2471 | 1, |
|
|
2472 | Height2Pixel (1)); |
|
|
2473 | } |
|
|
2474 | } |
2461 | else if (oldcursor.row >= 0) |
2475 | else if (oldcursor.row >= 0) |
2462 | { |
2476 | { |
2463 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2477 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2464 | |
2478 | |
2465 | XDrawRectangle (dpy, vt, gc, |
2479 | XDrawRectangle (dpy, vt, gc, |
… | |
… | |
2678 | |
2692 | |
2679 | void |
2693 | void |
2680 | rxvt_term::selection_changed () NOTHROW |
2694 | rxvt_term::selection_changed () NOTHROW |
2681 | { |
2695 | { |
2682 | line_t &r1 = ROW (selection.beg.row); |
2696 | line_t &r1 = ROW (selection.beg.row); |
2683 | while (selection.beg.col > 0 && r1.t [selection.beg.col] == NOCHAR) |
2697 | while (selection.beg.col < r1.l && r1.t [selection.beg.col] == NOCHAR) |
2684 | --selection.beg.col; |
2698 | ++selection.beg.col; |
2685 | |
2699 | |
2686 | line_t &r2 = ROW (selection.end.row); |
2700 | line_t &r2 = ROW (selection.end.row); |
2687 | while (selection.end.col < r2.l && r2.t [selection.end.col] == NOCHAR) |
2701 | while (selection.end.col < r2.l && r2.t [selection.end.col] == NOCHAR) |
2688 | ++selection.end.col; |
2702 | ++selection.end.col; |
2689 | |
2703 | |