… | |
… | |
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 | */ |
1242 | void |
1242 | void |
1243 | rxvt_term::scr_index (enum page_dirn direction) NOTHROW |
1243 | rxvt_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 | */ |
1903 | void |
1899 | void |
1904 | rxvt_term::scr_move_to (int y, int len) NOTHROW |
1900 | rxvt_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 |
1912 | * direction should be UP or DN |
1909 | * direction should be UP or DN |
1913 | */ |
1910 | */ |
1914 | bool |
1911 | bool |
1915 | rxvt_term::scr_page (enum page_dirn direction, int nlines) NOTHROW |
1912 | rxvt_term::scr_page (int nlines) NOTHROW |
1916 | { |
1913 | { |
1917 | int new_view_start = |
|
|
1918 | direction == UP ? view_start - nlines |
|
|
1919 | : view_start + nlines; |
|
|
1920 | |
|
|
1921 | return scr_changeview (new_view_start); |
1914 | return scr_changeview (view_start - nlines); |
1922 | } |
1915 | } |
1923 | |
1916 | |
1924 | bool |
1917 | bool |
1925 | rxvt_term::scr_changeview (int new_view_start) NOTHROW |
1918 | rxvt_term::scr_changeview (int new_view_start) NOTHROW |
1926 | { |
1919 | { |
… | |
… | |
2083 | |
2076 | |
2084 | /* |
2077 | /* |
2085 | * C: set the cursor character (s) |
2078 | * C: set the cursor character (s) |
2086 | */ |
2079 | */ |
2087 | { |
2080 | { |
2088 | bool setoldcursor; |
|
|
2089 | |
|
|
2090 | #ifdef CURSOR_BLINK |
2081 | #ifdef CURSOR_BLINK |
2091 | if (hidden_cursor) |
2082 | if (hidden_cursor) |
2092 | showcursor = 0; |
2083 | showcursor = 0; |
2093 | #endif |
2084 | #endif |
2094 | |
2085 | |
… | |
… | |
2145 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2136 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2146 | } |
2137 | } |
2147 | } |
2138 | } |
2148 | |
2139 | |
2149 | /* make sure no outline cursor is left around */ |
2140 | /* make sure no outline cursor is left around */ |
2150 | setoldcursor = 0; |
|
|
2151 | if (ocrow != -1) |
2141 | if (ocrow != -1) |
2152 | { |
2142 | { |
2153 | if (screen.cur.row - view_start != ocrow |
2143 | if (screen.cur.row - view_start != ocrow |
2154 | || screen.cur.col != oldcursor.col) |
2144 | || screen.cur.col != oldcursor.col) |
2155 | { |
2145 | { |
2156 | if (ocrow < nrow |
2146 | if (ocrow < nrow |
2157 | && oldcursor.col < ncol) |
2147 | && oldcursor.col < ncol) |
2158 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
2148 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
2159 | |
|
|
2160 | if (focus || !showcursor) |
|
|
2161 | oldcursor.row = -1; |
|
|
2162 | else |
|
|
2163 | setoldcursor = 1; |
|
|
2164 | } |
2149 | } |
2165 | } |
2150 | } |
2166 | else if (!focus) |
|
|
2167 | setoldcursor = 1; |
|
|
2168 | |
2151 | |
2169 | if (setoldcursor) |
2152 | // save the current cursor coordinates if the cursor is visible |
|
|
2153 | // and the window is unfocused, so as to clear the outline cursor |
|
|
2154 | // in the next refresh if the cursor moves |
|
|
2155 | if (showcursor && !focus && screen.cur.row - view_start < nrow) |
2170 | { |
2156 | { |
2171 | if (screen.cur.row - view_start >= nrow) |
|
|
2172 | oldcursor.row = -1; |
|
|
2173 | else |
|
|
2174 | { |
|
|
2175 | oldcursor.row = screen.cur.row - view_start; |
2157 | oldcursor.row = screen.cur.row - view_start; |
2176 | oldcursor.col = screen.cur.col; |
2158 | oldcursor.col = screen.cur.col; |
2177 | } |
|
|
2178 | } |
2159 | } |
|
|
2160 | else |
|
|
2161 | oldcursor.row = -1; |
2179 | } |
2162 | } |
2180 | |
2163 | |
2181 | #ifndef NO_SLOW_LINK_SUPPORT |
2164 | #ifndef NO_SLOW_LINK_SUPPORT |
2182 | /* |
2165 | /* |
2183 | * D: CopyArea pass - very useful for slower links |
2166 | * D: CopyArea pass - very useful for slower links |
… | |
… | |
2696 | |
2679 | |
2697 | void |
2680 | void |
2698 | rxvt_term::selection_changed () NOTHROW |
2681 | rxvt_term::selection_changed () NOTHROW |
2699 | { |
2682 | { |
2700 | line_t &r1 = ROW (selection.beg.row); |
2683 | line_t &r1 = ROW (selection.beg.row); |
2701 | while (selection.beg.col > 0 && r1.t [selection.beg.col] == NOCHAR) |
2684 | while (selection.beg.col < r1.l && r1.t [selection.beg.col] == NOCHAR) |
2702 | --selection.beg.col; |
2685 | ++selection.beg.col; |
2703 | |
2686 | |
2704 | line_t &r2 = ROW (selection.end.row); |
2687 | line_t &r2 = ROW (selection.end.row); |
2705 | while (selection.end.col < r2.l && r2.t [selection.end.col] == NOCHAR) |
2688 | while (selection.end.col < r2.l && r2.t [selection.end.col] == NOCHAR) |
2706 | ++selection.end.col; |
2689 | ++selection.end.col; |
2707 | |
2690 | |