… | |
… | |
2 | * File: screen.C |
2 | * File: screen.C |
3 | *---------------------------------------------------------------------------* |
3 | *---------------------------------------------------------------------------* |
4 | * |
4 | * |
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 | * Copyright (c) 2015 Emanuele Giaquinta <e.giaquinta@glauco.it> |
7 | * |
8 | * |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * 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 |
10 | * 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 |
11 | * the Free Software Foundation; either version 3 of the License, or |
11 | * (at your option) any later version. |
12 | * (at your option) any later version. |
12 | * |
13 | * |
13 | * This program is distributed in the hope that it will be useful, |
14 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
… | |
… | |
94 | * SCREEN `COMMON' ROUTINES * |
95 | * SCREEN `COMMON' ROUTINES * |
95 | * ------------------------------------------------------------------------- */ |
96 | * ------------------------------------------------------------------------- */ |
96 | |
97 | |
97 | /* Fill part/all of a line with blanks. */ |
98 | /* Fill part/all of a line with blanks. */ |
98 | void |
99 | void |
99 | rxvt_term::scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW |
100 | rxvt_term::scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const noexcept |
100 | { |
101 | { |
101 | if (!l.valid ()) |
102 | if (!l.valid ()) |
102 | { |
103 | { |
103 | l.alloc (); |
104 | l.alloc (); |
104 | col = 0; |
105 | col = 0; |
… | |
… | |
106 | } |
107 | } |
107 | |
108 | |
108 | l.touch (); |
109 | l.touch (); |
109 | |
110 | |
110 | efs &= ~RS_baseattrMask; // remove italic etc. fontstyles |
111 | efs &= ~RS_baseattrMask; // remove italic etc. fontstyles |
111 | efs = SET_FONT (efs, FONTSET (efs)->find_font (' ')); |
112 | efs = SET_FONT (efs, FONTSET (efs)->find_space_font ()); |
112 | |
113 | |
113 | text_t *et = l.t + col; |
114 | text_t *et = l.t + col; |
114 | rend_t *er = l.r + col; |
115 | rend_t *er = l.r + col; |
115 | |
116 | |
116 | while (width--) |
117 | while (width--) |
… | |
… | |
121 | } |
122 | } |
122 | |
123 | |
123 | /* ------------------------------------------------------------------------- */ |
124 | /* ------------------------------------------------------------------------- */ |
124 | /* Fill a full line with blanks - make sure it is allocated first */ |
125 | /* Fill a full line with blanks - make sure it is allocated first */ |
125 | void |
126 | void |
126 | rxvt_term::scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW |
127 | rxvt_term::scr_blank_screen_mem (line_t &l, rend_t efs) const noexcept |
127 | { |
128 | { |
128 | scr_blank_line (l, 0, ncol, efs); |
129 | scr_blank_line (l, 0, ncol, efs); |
129 | |
130 | |
130 | l.l = 0; |
131 | l.l = 0; |
131 | l.f = 0; |
132 | l.f = 0; |
132 | } |
133 | } |
133 | |
134 | |
134 | // nuke a single wide character at the given column |
135 | // nuke a single wide character at the given column |
135 | void |
136 | void |
136 | rxvt_term::scr_kill_char (line_t &l, int col) const NOTHROW |
137 | rxvt_term::scr_kill_char (line_t &l, int col) const noexcept |
137 | { |
138 | { |
138 | // find begin |
139 | // find begin |
139 | while (col > 0 && l.t[col] == NOCHAR) |
140 | while (col > 0 && l.t[col] == NOCHAR) |
140 | col--; |
141 | col--; |
141 | |
142 | |
142 | rend_t rend = l.r[col] & ~RS_baseattrMask; |
143 | rend_t rend = l.r[col] & ~RS_baseattrMask; |
143 | rend = SET_FONT (rend, FONTSET (rend)->find_font (' ')); |
144 | rend = SET_FONT (rend, FONTSET (rend)->find_space_font ()); |
144 | |
145 | |
145 | l.touch (); |
146 | l.touch (); |
146 | |
147 | |
147 | // found start, nuke |
148 | // found start, nuke |
148 | do { |
149 | do { |
… | |
… | |
165 | /* ------------------------------------------------------------------------- * |
166 | /* ------------------------------------------------------------------------- * |
166 | * SCREEN INITIALISATION * |
167 | * SCREEN INITIALISATION * |
167 | * ------------------------------------------------------------------------- */ |
168 | * ------------------------------------------------------------------------- */ |
168 | |
169 | |
169 | void |
170 | void |
170 | rxvt_term::scr_alloc () NOTHROW |
171 | rxvt_term::scr_alloc () noexcept |
171 | { |
172 | { |
172 | int tsize = sizeof (text_t) * ncol; |
173 | int tsize = sizeof (text_t) * ncol; |
173 | int rsize = sizeof (rend_t) * ncol; |
174 | int rsize = sizeof (rend_t) * ncol; |
174 | |
175 | |
175 | // we assume that rend_t size is a sufficient alignment |
176 | // we assume that rend_t size is a sufficient alignment |
… | |
… | |
254 | |
255 | |
255 | scr_alloc (); |
256 | scr_alloc (); |
256 | |
257 | |
257 | if (!prev_row_buf) |
258 | if (!prev_row_buf) |
258 | { |
259 | { |
259 | /* |
|
|
260 | * first time called (or after scr_release) so just malloc everything: don't rely on realloc |
|
|
261 | */ |
|
|
262 | top_row = 0; |
260 | top_row = 0; |
263 | term_start = 0; |
261 | term_start = 0; |
264 | |
262 | |
265 | memset (charsets, 'B', sizeof (charsets)); |
263 | memset (charsets, 'B', sizeof (charsets)); |
266 | rstyle = DEFAULT_RSTYLE; |
264 | rstyle = DEFAULT_RSTYLE; |
… | |
… | |
291 | { |
289 | { |
292 | /* |
290 | /* |
293 | * add or delete rows as appropriate |
291 | * add or delete rows as appropriate |
294 | */ |
292 | */ |
295 | |
293 | |
|
|
294 | int common_col = min (prev_ncol, ncol); |
|
|
295 | |
296 | for (int row = min (nrow, prev_nrow); row--; ) |
296 | for (int row = min (nrow, prev_nrow); row--; ) |
297 | { |
297 | { |
298 | copy_line (drawn_buf [row], prev_drawn_buf [row]); |
298 | scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); |
|
|
299 | memcpy (drawn_buf [row].t, prev_drawn_buf [row].t, sizeof (text_t) * common_col); |
|
|
300 | memcpy (drawn_buf [row].r, prev_drawn_buf [row].r, sizeof (rend_t) * common_col); |
|
|
301 | |
299 | copy_line (swap_buf [row], prev_swap_buf [row]); |
302 | copy_line (swap_buf [row], prev_swap_buf [row]); |
300 | } |
303 | } |
301 | |
304 | |
302 | int p = MOD (term_start + prev_nrow, prev_total_rows); // previous row |
305 | int p = MOD (term_start + prev_nrow, prev_total_rows); // previous row |
303 | int pend = MOD (term_start + top_row , prev_total_rows); |
306 | int pend = MOD (term_start + top_row , prev_total_rows); |
304 | int q = total_rows; // rewrapped row |
307 | int q = total_rows; // rewrapped row |
305 | |
308 | |
306 | if (top_row) |
309 | if ((rewrap_always || top_row) && !rewrap_never) |
307 | { |
310 | { |
308 | // Re-wrap lines. This is rather ugly, possibly because I am too dumb |
311 | // Re-wrap lines. This is rather ugly, possibly because I am too dumb |
309 | // to come up with a lean and mean algorithm. |
312 | // to come up with a lean and mean algorithm. |
310 | // TODO: maybe optimise when width didn't change |
313 | // TODO: maybe optimise when width didn't change |
311 | |
314 | |
… | |
… | |
438 | |
441 | |
439 | HOOK_INVOKE ((this, HOOK_RESET, DT_END)); |
442 | HOOK_INVOKE ((this, HOOK_RESET, DT_END)); |
440 | } |
443 | } |
441 | |
444 | |
442 | void ecb_cold |
445 | void ecb_cold |
443 | rxvt_term::scr_release () NOTHROW |
446 | rxvt_term::scr_release () noexcept |
444 | { |
447 | { |
445 | chunk_free (chunk, chunk_size); |
448 | chunk_free (chunk, chunk_size); |
446 | chunk = 0; |
449 | chunk = 0; |
447 | row_buf = 0; |
450 | row_buf = 0; |
448 | |
451 | |
… | |
… | |
467 | scr_clear (true); |
470 | scr_clear (true); |
468 | scr_refresh (); |
471 | scr_refresh (); |
469 | } |
472 | } |
470 | |
473 | |
471 | void ecb_cold |
474 | void ecb_cold |
472 | rxvt_term::scr_soft_reset () NOTHROW |
475 | rxvt_term::scr_soft_reset () noexcept |
473 | { |
476 | { |
474 | /* only affects modes, nothing drastic such as clearing the screen */ |
477 | /* only affects modes, nothing drastic such as clearing the screen */ |
475 | #if ENABLE_OVERLAY |
478 | #if ENABLE_OVERLAY |
476 | scr_overlay_off (); |
479 | scr_overlay_off (); |
477 | #endif |
480 | #endif |
… | |
… | |
491 | * Save and Restore cursor |
494 | * Save and Restore cursor |
492 | * XTERM_SEQ: Save cursor : ESC 7 |
495 | * XTERM_SEQ: Save cursor : ESC 7 |
493 | * XTERM_SEQ: Restore cursor: ESC 8 |
496 | * XTERM_SEQ: Restore cursor: ESC 8 |
494 | */ |
497 | */ |
495 | void |
498 | void |
496 | rxvt_term::scr_cursor (cursor_mode mode) NOTHROW |
499 | rxvt_term::scr_cursor (cursor_mode mode) noexcept |
497 | { |
500 | { |
498 | screen_t *s; |
501 | screen_t *s; |
499 | |
502 | |
500 | #if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) |
503 | #if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) |
501 | if (current_screen == SECONDARY) |
504 | if (current_screen == SECONDARY) |
… | |
… | |
532 | assert (s->cur.row >= 0); |
535 | assert (s->cur.row >= 0); |
533 | assert (s->cur.col >= 0); |
536 | assert (s->cur.col >= 0); |
534 | } |
537 | } |
535 | |
538 | |
536 | void |
539 | void |
537 | rxvt_term::scr_swap_screen () NOTHROW |
540 | rxvt_term::scr_swap_screen () noexcept |
538 | { |
541 | { |
539 | if (!option (Opt_secondaryScreen)) |
542 | if (!option (Opt_secondaryScreen)) |
540 | return; |
543 | return; |
541 | |
544 | |
542 | for (int i = prev_nrow; i--; ) |
545 | for (int i = prev_nrow; i--; ) |
… | |
… | |
590 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
593 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
591 | } |
594 | } |
592 | |
595 | |
593 | // clear WrapNext indicator, solidifying position on next line |
596 | // clear WrapNext indicator, solidifying position on next line |
594 | void |
597 | void |
595 | rxvt_term::scr_do_wrap () NOTHROW |
598 | rxvt_term::scr_do_wrap () noexcept |
596 | { |
599 | { |
597 | if (!(screen.flags & Screen_WrapNext)) |
600 | if (!(screen.flags & Screen_WrapNext)) |
598 | return; |
601 | return; |
599 | |
602 | |
600 | screen.flags &= ~Screen_WrapNext; |
603 | screen.flags &= ~Screen_WrapNext; |
… | |
… | |
610 | /* ------------------------------------------------------------------------- */ |
613 | /* ------------------------------------------------------------------------- */ |
611 | /* |
614 | /* |
612 | * Change the colour for following text |
615 | * Change the colour for following text |
613 | */ |
616 | */ |
614 | void |
617 | void |
615 | rxvt_term::scr_color (unsigned int color, int fgbg) NOTHROW |
618 | rxvt_term::scr_color (unsigned int color, int fgbg) noexcept |
616 | { |
619 | { |
617 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
620 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR24)) |
618 | color = fgbg; |
621 | color = fgbg; |
619 | |
622 | |
620 | if (fgbg == Color_fg) |
623 | if (fgbg == Color_fg) |
621 | rstyle = SET_FGCOLOR (rstyle, color); |
624 | rstyle = SET_FGCOLOR (rstyle, color); |
622 | else |
625 | else |
… | |
… | |
626 | /* ------------------------------------------------------------------------- */ |
629 | /* ------------------------------------------------------------------------- */ |
627 | /* |
630 | /* |
628 | * Change the rendition style for following text |
631 | * Change the rendition style for following text |
629 | */ |
632 | */ |
630 | void |
633 | void |
631 | rxvt_term::scr_rendition (int set, int style) NOTHROW |
634 | rxvt_term::scr_rendition (int set, int style) noexcept |
632 | { |
635 | { |
633 | if (set) |
636 | if (set) |
634 | rstyle |= style; |
637 | rstyle |= style; |
635 | else if (style == ~RS_None) |
638 | else if (style == ~RS_None) |
636 | rstyle = DEFAULT_RSTYLE; |
639 | rstyle = DEFAULT_RSTYLE; |
… | |
… | |
643 | * Scroll text between <row1> and <row2> inclusive, by <count> lines |
646 | * Scroll text between <row1> and <row2> inclusive, by <count> lines |
644 | * count positive ==> scroll up |
647 | * count positive ==> scroll up |
645 | * count negative ==> scroll down |
648 | * count negative ==> scroll down |
646 | */ |
649 | */ |
647 | int ecb_hot |
650 | int ecb_hot |
648 | rxvt_term::scr_scroll_text (int row1, int row2, int count) NOTHROW |
651 | rxvt_term::scr_scroll_text (int row1, int row2, int count) noexcept |
649 | { |
652 | { |
650 | if (count == 0 || (row1 > row2)) |
653 | if (count == 0 || (row1 > row2)) |
651 | return 0; |
654 | return 0; |
652 | |
655 | |
653 | want_refresh = 1; |
656 | want_refresh = 1; |
… | |
… | |
713 | |
716 | |
714 | // finally move the view window, if desired |
717 | // finally move the view window, if desired |
715 | if (option (Opt_scrollWithBuffer) |
718 | if (option (Opt_scrollWithBuffer) |
716 | && view_start != 0 |
719 | && view_start != 0 |
717 | && view_start != -saveLines) |
720 | && view_start != -saveLines) |
718 | scr_page (UP, count); |
721 | scr_page (count); |
719 | |
722 | |
720 | if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) |
723 | if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) |
721 | HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, top_row, DT_END)); |
724 | HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, top_row, DT_END)); |
722 | } |
725 | } |
723 | else |
726 | else |
… | |
… | |
787 | /* ------------------------------------------------------------------------- */ |
790 | /* ------------------------------------------------------------------------- */ |
788 | /* |
791 | /* |
789 | * Add text given in <str> of length <len> to screen struct |
792 | * Add text given in <str> of length <len> to screen struct |
790 | */ |
793 | */ |
791 | void ecb_hot |
794 | void ecb_hot |
792 | rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) NOTHROW |
795 | rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) noexcept |
793 | { |
796 | { |
794 | if (len <= 0) /* sanity */ |
797 | if (len <= 0) /* sanity */ |
795 | return; |
798 | return; |
796 | |
799 | |
797 | bool checksel; |
800 | bool checksel; |
… | |
… | |
1009 | } |
1012 | } |
1010 | else if (screen.cur.row > 0 |
1013 | else if (screen.cur.row > 0 |
1011 | && ROW(screen.cur.row - 1).is_longer ()) |
1014 | && ROW(screen.cur.row - 1).is_longer ()) |
1012 | { |
1015 | { |
1013 | linep = &ROW(screen.cur.row - 1); |
1016 | linep = &ROW(screen.cur.row - 1); |
1014 | tp = line->t + ncol - 1; |
1017 | tp = linep->t + ncol - 1; |
1015 | rp = line->r + ncol - 1; |
1018 | rp = linep->r + ncol - 1; |
1016 | } |
1019 | } |
1017 | else |
1020 | else |
1018 | continue; |
1021 | continue; |
1019 | |
1022 | |
1020 | linep->touch (); |
1023 | linep->touch (); |
… | |
… | |
1043 | /* |
1046 | /* |
1044 | * Process Backspace. Move back the cursor back a position, wrap if have to |
1047 | * Process Backspace. Move back the cursor back a position, wrap if have to |
1045 | * XTERM_SEQ: CTRL-H |
1048 | * XTERM_SEQ: CTRL-H |
1046 | */ |
1049 | */ |
1047 | void |
1050 | void |
1048 | rxvt_term::scr_backspace () NOTHROW |
1051 | rxvt_term::scr_backspace () noexcept |
1049 | { |
1052 | { |
1050 | if (screen.cur.col == 0) |
1053 | if (screen.cur.col == 0) |
1051 | { |
1054 | { |
1052 | if (screen.cur.row > 0) |
1055 | if (screen.cur.row > 0) |
1053 | { |
1056 | { |
… | |
… | |
1070 | * Process Horizontal Tab |
1073 | * Process Horizontal Tab |
1071 | * count: +ve = forward; -ve = backwards |
1074 | * count: +ve = forward; -ve = backwards |
1072 | * XTERM_SEQ: CTRL-I |
1075 | * XTERM_SEQ: CTRL-I |
1073 | */ |
1076 | */ |
1074 | void |
1077 | void |
1075 | rxvt_term::scr_tab (int count, bool ht) NOTHROW |
1078 | rxvt_term::scr_tab (int count, bool ht) noexcept |
1076 | { |
1079 | { |
1077 | int i, x; |
1080 | int i, x; |
1078 | |
1081 | |
1079 | want_refresh = 1; |
1082 | want_refresh = 1; |
1080 | i = x = screen.cur.col; |
1083 | i = x = screen.cur.col; |
… | |
… | |
1147 | * Move cursor left in row. If we're at the left boundary, shift everything |
1150 | * Move cursor left in row. If we're at the left boundary, shift everything |
1148 | * in that row right. Clear left column. |
1151 | * in that row right. Clear left column. |
1149 | */ |
1152 | */ |
1150 | #if !ENABLE_MINIMAL |
1153 | #if !ENABLE_MINIMAL |
1151 | void ecb_cold |
1154 | void ecb_cold |
1152 | rxvt_term::scr_backindex () NOTHROW |
1155 | rxvt_term::scr_backindex () noexcept |
1153 | { |
1156 | { |
1154 | if (screen.cur.col > 0) |
1157 | if (screen.cur.col > 0) |
1155 | scr_gotorc (0, -1, R_RELATIVE | C_RELATIVE); |
1158 | scr_gotorc (0, -1, R_RELATIVE | C_RELATIVE); |
1156 | else |
1159 | else |
1157 | scr_insdel_chars (1, INSERT); |
1160 | scr_insdel_chars (1, INSERT); |
… | |
… | |
1164 | * Move cursor right in row. If we're at the right boundary, shift everything |
1167 | * Move cursor right in row. If we're at the right boundary, shift everything |
1165 | * in that row left. Clear right column. |
1168 | * in that row left. Clear right column. |
1166 | */ |
1169 | */ |
1167 | #if !ENABLE_MINIMAL |
1170 | #if !ENABLE_MINIMAL |
1168 | void ecb_cold |
1171 | void ecb_cold |
1169 | rxvt_term::scr_forwardindex () NOTHROW |
1172 | rxvt_term::scr_forwardindex () noexcept |
1170 | { |
1173 | { |
1171 | if (screen.cur.col < ncol - 1) |
1174 | if (screen.cur.col < ncol - 1) |
1172 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1175 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1173 | else |
1176 | else |
1174 | { |
1177 | { |
… | |
… | |
1187 | /* ------------------------------------------------------------------------- */ |
1190 | /* ------------------------------------------------------------------------- */ |
1188 | /* |
1191 | /* |
1189 | * Goto Row/Column |
1192 | * Goto Row/Column |
1190 | */ |
1193 | */ |
1191 | void |
1194 | void |
1192 | rxvt_term::scr_gotorc (int row, int col, int relative) NOTHROW |
1195 | rxvt_term::scr_gotorc (int row, int col, int relative) noexcept |
1193 | { |
1196 | { |
1194 | want_refresh = 1; |
1197 | want_refresh = 1; |
1195 | ZERO_SCROLLBACK (); |
1198 | ZERO_SCROLLBACK (); |
1196 | |
1199 | |
1197 | screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; |
1200 | screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; |
… | |
… | |
1236 | /* ------------------------------------------------------------------------- */ |
1239 | /* ------------------------------------------------------------------------- */ |
1237 | /* |
1240 | /* |
1238 | * direction should be UP or DN |
1241 | * direction should be UP or DN |
1239 | */ |
1242 | */ |
1240 | void |
1243 | void |
1241 | rxvt_term::scr_index (enum page_dirn direction) NOTHROW |
1244 | rxvt_term::scr_index (enum page_dirn direction) noexcept |
1242 | { |
1245 | { |
1243 | int dirn; |
|
|
1244 | |
|
|
1245 | want_refresh = 1; |
1246 | want_refresh = 1; |
1246 | ZERO_SCROLLBACK (); |
1247 | ZERO_SCROLLBACK (); |
1247 | |
1248 | |
1248 | dirn = ((direction == UP) ? 1 : -1); |
|
|
1249 | |
|
|
1250 | screen.flags &= ~Screen_WrapNext; |
1249 | screen.flags &= ~Screen_WrapNext; |
1251 | |
1250 | |
1252 | if ((screen.cur.row == screen.bscroll && direction == UP) |
1251 | if ((screen.cur.row == screen.bscroll && direction == UP) |
1253 | || (screen.cur.row == screen.tscroll && direction == DN)) |
1252 | || (screen.cur.row == screen.tscroll && direction == DN)) |
1254 | scr_scroll_text (screen.tscroll, screen.bscroll, dirn); |
1253 | scr_scroll_text (screen.tscroll, screen.bscroll, direction); |
1255 | else |
1254 | else |
1256 | screen.cur.row += dirn; |
1255 | screen.cur.row += direction; |
1257 | |
1256 | |
1258 | clamp_it (screen.cur.row, 0, nrow - 1); |
1257 | clamp_it (screen.cur.row, 0, nrow - 1); |
1259 | selection_check (0); |
1258 | selection_check (0); |
1260 | } |
1259 | } |
1261 | |
1260 | |
… | |
… | |
1266 | * XTERM_SEQ: Clear line to left : ESC [ 1 K |
1265 | * XTERM_SEQ: Clear line to left : ESC [ 1 K |
1267 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1266 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1268 | * extension: clear to right unless wrapped: ESC [ 3 K |
1267 | * extension: clear to right unless wrapped: ESC [ 3 K |
1269 | */ |
1268 | */ |
1270 | void |
1269 | void |
1271 | rxvt_term::scr_erase_line (int mode) NOTHROW |
1270 | rxvt_term::scr_erase_line (int mode) noexcept |
1272 | { |
1271 | { |
1273 | unsigned int col, num; |
1272 | unsigned int col, num; |
1274 | |
1273 | |
1275 | want_refresh = 1; |
1274 | want_refresh = 1; |
1276 | ZERO_SCROLLBACK (); |
1275 | ZERO_SCROLLBACK (); |
… | |
… | |
1330 | * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J |
1329 | * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J |
1331 | * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J |
1330 | * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J |
1332 | * XTERM_SEQ: Clear whole screen : ESC [ 2 J |
1331 | * XTERM_SEQ: Clear whole screen : ESC [ 2 J |
1333 | */ |
1332 | */ |
1334 | void |
1333 | void |
1335 | rxvt_term::scr_erase_screen (int mode) NOTHROW |
1334 | rxvt_term::scr_erase_screen (int mode) noexcept |
1336 | { |
1335 | { |
1337 | int num; |
1336 | int num; |
1338 | int32_t row; |
1337 | int32_t row; |
1339 | rend_t ren; |
1338 | rend_t ren; |
1340 | XGCValues gcvalue; |
1339 | XGCValues gcvalue; |
… | |
… | |
1410 | } |
1409 | } |
1411 | } |
1410 | } |
1412 | |
1411 | |
1413 | #if !ENABLE_MINIMAL |
1412 | #if !ENABLE_MINIMAL |
1414 | void |
1413 | void |
1415 | rxvt_term::scr_erase_savelines () NOTHROW |
1414 | rxvt_term::scr_erase_savelines () noexcept |
1416 | { |
1415 | { |
1417 | want_refresh = 1; |
1416 | want_refresh = 1; |
1418 | ZERO_SCROLLBACK (); |
1417 | ZERO_SCROLLBACK (); |
1419 | |
1418 | |
1420 | top_row = 0; |
1419 | top_row = 0; |
… | |
… | |
1425 | /* |
1424 | /* |
1426 | * Fill the screen with `E's |
1425 | * Fill the screen with `E's |
1427 | * XTERM_SEQ: Screen Alignment Test: ESC # 8 |
1426 | * XTERM_SEQ: Screen Alignment Test: ESC # 8 |
1428 | */ |
1427 | */ |
1429 | void ecb_cold |
1428 | void ecb_cold |
1430 | rxvt_term::scr_E () NOTHROW |
1429 | rxvt_term::scr_E () noexcept |
1431 | { |
1430 | { |
1432 | rend_t fs; |
1431 | rend_t fs; |
1433 | |
1432 | |
1434 | want_refresh = 1; |
1433 | want_refresh = 1; |
1435 | ZERO_SCROLLBACK (); |
1434 | ZERO_SCROLLBACK (); |
… | |
… | |
1460 | /* ------------------------------------------------------------------------- */ |
1459 | /* ------------------------------------------------------------------------- */ |
1461 | /* |
1460 | /* |
1462 | * Insert/Delete <count> lines |
1461 | * Insert/Delete <count> lines |
1463 | */ |
1462 | */ |
1464 | void |
1463 | void |
1465 | rxvt_term::scr_insdel_lines (int count, int insdel) NOTHROW |
1464 | rxvt_term::scr_insdel_lines (int count, int insdel) noexcept |
1466 | { |
1465 | { |
1467 | int end; |
1466 | int end; |
1468 | |
1467 | |
1469 | ZERO_SCROLLBACK (); |
1468 | ZERO_SCROLLBACK (); |
1470 | |
1469 | |
… | |
… | |
1490 | /* ------------------------------------------------------------------------- */ |
1489 | /* ------------------------------------------------------------------------- */ |
1491 | /* |
1490 | /* |
1492 | * Insert/Delete <count> characters from the current position |
1491 | * Insert/Delete <count> characters from the current position |
1493 | */ |
1492 | */ |
1494 | void |
1493 | void |
1495 | rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW |
1494 | rxvt_term::scr_insdel_chars (int count, int insdel) noexcept |
1496 | { |
1495 | { |
1497 | want_refresh = 1; |
1496 | want_refresh = 1; |
1498 | ZERO_SCROLLBACK (); |
1497 | ZERO_SCROLLBACK (); |
1499 | |
1498 | |
1500 | if (count <= 0) |
1499 | if (count <= 0) |
… | |
… | |
1599 | /* |
1598 | /* |
1600 | * Set the scrolling region |
1599 | * Set the scrolling region |
1601 | * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r |
1600 | * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r |
1602 | */ |
1601 | */ |
1603 | void ecb_cold |
1602 | void ecb_cold |
1604 | rxvt_term::scr_scroll_region (int top, int bot) NOTHROW |
1603 | rxvt_term::scr_scroll_region (int top, int bot) noexcept |
1605 | { |
1604 | { |
1606 | max_it (top, 0); |
1605 | max_it (top, 0); |
1607 | min_it (bot, nrow - 1); |
1606 | min_it (bot, nrow - 1); |
1608 | |
1607 | |
1609 | if (top > bot) |
1608 | if (top > bot) |
… | |
… | |
1619 | * Make the cursor visible/invisible |
1618 | * Make the cursor visible/invisible |
1620 | * XTERM_SEQ: Make cursor visible : ESC [ ? 25 h |
1619 | * XTERM_SEQ: Make cursor visible : ESC [ ? 25 h |
1621 | * XTERM_SEQ: Make cursor invisible: ESC [ ? 25 l |
1620 | * XTERM_SEQ: Make cursor invisible: ESC [ ? 25 l |
1622 | */ |
1621 | */ |
1623 | void ecb_cold |
1622 | void ecb_cold |
1624 | rxvt_term::scr_cursor_visible (int mode) NOTHROW |
1623 | rxvt_term::scr_cursor_visible (int mode) noexcept |
1625 | { |
1624 | { |
1626 | want_refresh = 1; |
1625 | want_refresh = 1; |
1627 | |
1626 | |
1628 | if (mode) |
1627 | if (mode) |
1629 | screen.flags |= Screen_VisibleCursor; |
1628 | screen.flags |= Screen_VisibleCursor; |
… | |
… | |
1636 | * Set/unset automatic wrapping |
1635 | * Set/unset automatic wrapping |
1637 | * XTERM_SEQ: Set Wraparound : ESC [ ? 7 h |
1636 | * XTERM_SEQ: Set Wraparound : ESC [ ? 7 h |
1638 | * XTERM_SEQ: Unset Wraparound: ESC [ ? 7 l |
1637 | * XTERM_SEQ: Unset Wraparound: ESC [ ? 7 l |
1639 | */ |
1638 | */ |
1640 | void ecb_cold |
1639 | void ecb_cold |
1641 | rxvt_term::scr_autowrap (int mode) NOTHROW |
1640 | rxvt_term::scr_autowrap (int mode) noexcept |
1642 | { |
1641 | { |
1643 | if (mode) |
1642 | if (mode) |
1644 | screen.flags |= Screen_Autowrap; |
1643 | screen.flags |= Screen_Autowrap; |
1645 | else |
1644 | else |
1646 | screen.flags &= ~(Screen_Autowrap | Screen_WrapNext); |
1645 | screen.flags &= ~(Screen_Autowrap | Screen_WrapNext); |
… | |
… | |
1655 | * and the cursor cannot be moved outside. |
1654 | * and the cursor cannot be moved outside. |
1656 | * XTERM_SEQ: Set Absolute: ESC [ ? 6 h |
1655 | * XTERM_SEQ: Set Absolute: ESC [ ? 6 h |
1657 | * XTERM_SEQ: Set Relative: ESC [ ? 6 l |
1656 | * XTERM_SEQ: Set Relative: ESC [ ? 6 l |
1658 | */ |
1657 | */ |
1659 | void ecb_cold |
1658 | void ecb_cold |
1660 | rxvt_term::scr_relative_origin (int mode) NOTHROW |
1659 | rxvt_term::scr_relative_origin (int mode) noexcept |
1661 | { |
1660 | { |
1662 | if (mode) |
1661 | if (mode) |
1663 | screen.flags |= Screen_Relative; |
1662 | screen.flags |= Screen_Relative; |
1664 | else |
1663 | else |
1665 | screen.flags &= ~Screen_Relative; |
1664 | screen.flags &= ~Screen_Relative; |
… | |
… | |
1672 | * Set insert/replace mode |
1671 | * Set insert/replace mode |
1673 | * XTERM_SEQ: Set Insert mode : ESC [ ? 4 h |
1672 | * XTERM_SEQ: Set Insert mode : ESC [ ? 4 h |
1674 | * XTERM_SEQ: Set Replace mode: ESC [ ? 4 l |
1673 | * XTERM_SEQ: Set Replace mode: ESC [ ? 4 l |
1675 | */ |
1674 | */ |
1676 | void ecb_cold |
1675 | void ecb_cold |
1677 | rxvt_term::scr_insert_mode (int mode) NOTHROW |
1676 | rxvt_term::scr_insert_mode (int mode) noexcept |
1678 | { |
1677 | { |
1679 | if (mode) |
1678 | if (mode) |
1680 | screen.flags |= Screen_Insert; |
1679 | screen.flags |= Screen_Insert; |
1681 | else |
1680 | else |
1682 | screen.flags &= ~Screen_Insert; |
1681 | screen.flags &= ~Screen_Insert; |
… | |
… | |
1688 | * XTERM_SEQ: Set tab at current column : ESC H |
1687 | * XTERM_SEQ: Set tab at current column : ESC H |
1689 | * XTERM_SEQ: Clear tab at current column: ESC [ 0 g |
1688 | * XTERM_SEQ: Clear tab at current column: ESC [ 0 g |
1690 | * XTERM_SEQ: Clear all tabs : ESC [ 3 g |
1689 | * XTERM_SEQ: Clear all tabs : ESC [ 3 g |
1691 | */ |
1690 | */ |
1692 | void ecb_cold |
1691 | void ecb_cold |
1693 | rxvt_term::scr_set_tab (int mode) NOTHROW |
1692 | rxvt_term::scr_set_tab (int mode) noexcept |
1694 | { |
1693 | { |
1695 | if (mode < 0) |
1694 | if (mode < 0) |
1696 | memset (tabs, 0, ncol); |
1695 | memset (tabs, 0, ncol); |
1697 | else if (screen.cur.col < ncol) |
1696 | else if (screen.cur.col < ncol) |
1698 | tabs [screen.cur.col] = !!mode; |
1697 | tabs [screen.cur.col] = !!mode; |
… | |
… | |
1703 | * Set reverse/normal video |
1702 | * Set reverse/normal video |
1704 | * XTERM_SEQ: Reverse video: ESC [ ? 5 h |
1703 | * XTERM_SEQ: Reverse video: ESC [ ? 5 h |
1705 | * XTERM_SEQ: Normal video : ESC [ ? 5 l |
1704 | * XTERM_SEQ: Normal video : ESC [ ? 5 l |
1706 | */ |
1705 | */ |
1707 | void |
1706 | void |
1708 | rxvt_term::scr_rvideo_mode (bool on) NOTHROW |
1707 | rxvt_term::scr_rvideo_mode (bool on) noexcept |
1709 | { |
1708 | { |
1710 | rvideo_mode = on; |
1709 | rvideo_mode = on; |
1711 | |
1710 | |
1712 | #ifndef NO_BELL |
1711 | #ifndef NO_BELL |
1713 | on ^= rvideo_bell; |
1712 | on ^= rvideo_bell; |
… | |
… | |
1715 | |
1714 | |
1716 | if (rvideo_state != on) |
1715 | if (rvideo_state != on) |
1717 | { |
1716 | { |
1718 | rvideo_state = on; |
1717 | rvideo_state = on; |
1719 | |
1718 | |
|
|
1719 | #if OFF_FOCUS_FADING |
|
|
1720 | if (rs[Rs_fade]) |
|
|
1721 | { |
|
|
1722 | ::swap (pix_colors_focused[Color_fg], pix_colors_focused[Color_bg]); |
|
|
1723 | ::swap (pix_colors_unfocused[Color_fg], pix_colors_unfocused[Color_bg]); |
|
|
1724 | } |
|
|
1725 | else |
|
|
1726 | #endif |
1720 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1727 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1721 | #ifdef HAVE_IMG |
1728 | #ifdef HAVE_IMG |
1722 | if (bg_img == 0) |
1729 | if (bg_img == 0) |
1723 | #endif |
1730 | #endif |
1724 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
1731 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
… | |
… | |
1737 | /* |
1744 | /* |
1738 | * Report current cursor position |
1745 | * Report current cursor position |
1739 | * XTERM_SEQ: Report position: ESC [ 6 n |
1746 | * XTERM_SEQ: Report position: ESC [ 6 n |
1740 | */ |
1747 | */ |
1741 | void ecb_cold |
1748 | void ecb_cold |
1742 | rxvt_term::scr_report_position () NOTHROW |
1749 | rxvt_term::scr_report_position () noexcept |
1743 | { |
1750 | { |
1744 | tt_printf ("\033[%d;%dR", screen.cur.row + 1, screen.cur.col + 1); |
1751 | tt_printf ("\033[%d;%dR", screen.cur.row + 1, screen.cur.col + 1); |
1745 | } |
1752 | } |
1746 | |
1753 | |
1747 | /* ------------------------------------------------------------------------- * |
1754 | /* ------------------------------------------------------------------------- * |
… | |
… | |
1750 | |
1757 | |
1751 | /* |
1758 | /* |
1752 | * Set font style |
1759 | * Set font style |
1753 | */ |
1760 | */ |
1754 | void ecb_cold |
1761 | void ecb_cold |
1755 | rxvt_term::set_font_style () NOTHROW |
1762 | rxvt_term::set_font_style () noexcept |
1756 | { |
1763 | { |
1757 | #if 0 |
1764 | #if 0 |
1758 | switch (charsets [screen.charset]) |
1765 | switch (charsets [screen.charset]) |
1759 | { |
1766 | { |
1760 | case '0': /* DEC Special Character & Line Drawing Set */ |
1767 | case '0': /* DEC Special Character & Line Drawing Set */ |
… | |
… | |
1782 | * XTERM_SEQ: Invoke G1 character set: CTRL-N |
1789 | * XTERM_SEQ: Invoke G1 character set: CTRL-N |
1783 | * XTERM_SEQ: Invoke G2 character set: ESC N |
1790 | * XTERM_SEQ: Invoke G2 character set: ESC N |
1784 | * XTERM_SEQ: Invoke G3 character set: ESC O |
1791 | * XTERM_SEQ: Invoke G3 character set: ESC O |
1785 | */ |
1792 | */ |
1786 | void ecb_cold |
1793 | void ecb_cold |
1787 | rxvt_term::scr_charset_choose (int set) NOTHROW |
1794 | rxvt_term::scr_charset_choose (int set) noexcept |
1788 | { |
1795 | { |
1789 | screen.charset = set; |
1796 | screen.charset = set; |
1790 | set_font_style (); |
1797 | set_font_style (); |
1791 | } |
1798 | } |
1792 | |
1799 | |
… | |
… | |
1798 | * XTERM_SEQ: Set G2 character set: ESC * <C> |
1805 | * XTERM_SEQ: Set G2 character set: ESC * <C> |
1799 | * XTERM_SEQ: Set G3 character set: ESC + <C> |
1806 | * XTERM_SEQ: Set G3 character set: ESC + <C> |
1800 | * See set_font_style for possible values for <C> |
1807 | * See set_font_style for possible values for <C> |
1801 | */ |
1808 | */ |
1802 | void |
1809 | void |
1803 | rxvt_term::scr_charset_set (int set, unsigned int ch) NOTHROW |
1810 | rxvt_term::scr_charset_set (int set, unsigned int ch) noexcept |
1804 | { |
1811 | { |
1805 | charsets[set] = (unsigned char)ch; |
1812 | charsets[set] = (unsigned char)ch; |
1806 | set_font_style (); |
1813 | set_font_style (); |
1807 | } |
1814 | } |
1808 | |
1815 | |
… | |
… | |
1813 | |
1820 | |
1814 | /* |
1821 | /* |
1815 | * refresh matching text. |
1822 | * refresh matching text. |
1816 | */ |
1823 | */ |
1817 | bool ecb_cold |
1824 | bool ecb_cold |
1818 | rxvt_term::scr_refresh_rend (rend_t mask, rend_t value) NOTHROW |
1825 | rxvt_term::scr_refresh_rend (rend_t mask, rend_t value) noexcept |
1819 | { |
1826 | { |
1820 | bool found = false; |
1827 | bool found = false; |
1821 | |
1828 | |
1822 | for (int i = 0; i < nrow; i++) |
1829 | for (int i = 0; i < nrow; i++) |
1823 | { |
1830 | { |
… | |
… | |
1842 | PART_END, |
1849 | PART_END, |
1843 | RC_COUNT |
1850 | RC_COUNT |
1844 | }; |
1851 | }; |
1845 | |
1852 | |
1846 | void ecb_hot |
1853 | void ecb_hot |
1847 | rxvt_term::scr_expose (int x, int y, int ewidth, int eheight, bool refresh) NOTHROW |
1854 | rxvt_term::scr_expose (int x, int y, int ewidth, int eheight, bool refresh) noexcept |
1848 | { |
1855 | { |
1849 | int i; |
1856 | int i; |
1850 | row_col_t rc[RC_COUNT]; |
1857 | row_col_t rc[RC_COUNT]; |
1851 | |
1858 | |
1852 | if (!drawn_buf) /* sanity check */ |
1859 | if (!drawn_buf) /* sanity check */ |
… | |
… | |
1886 | /* ------------------------------------------------------------------------- */ |
1893 | /* ------------------------------------------------------------------------- */ |
1887 | /* |
1894 | /* |
1888 | * Refresh the entire screen |
1895 | * Refresh the entire screen |
1889 | */ |
1896 | */ |
1890 | void |
1897 | void |
1891 | rxvt_term::scr_touch (bool refresh) NOTHROW |
1898 | rxvt_term::scr_touch (bool refresh) noexcept |
1892 | { |
1899 | { |
1893 | scr_expose (0, 0, vt_width, vt_height, refresh); |
1900 | scr_expose (0, 0, vt_width, vt_height, refresh); |
1894 | } |
1901 | } |
1895 | |
1902 | |
1896 | /* ------------------------------------------------------------------------- */ |
1903 | /* ------------------------------------------------------------------------- */ |
1897 | /* |
1904 | /* |
1898 | * Move the display so that the line represented by scrollbar value Y is at |
1905 | * Move the display so that the line represented by scrollbar value Y is at |
1899 | * the top of the screen |
1906 | * the top of the screen |
1900 | */ |
1907 | */ |
1901 | void |
1908 | void |
1902 | rxvt_term::scr_move_to (int y, int len) NOTHROW |
1909 | rxvt_term::scr_move_to (int y, int len) noexcept |
1903 | { |
1910 | { |
1904 | scr_changeview ((top_row - nrow) * (len - y) / len + (nrow - 1)); |
1911 | // lerp (y, 0, len, top_row, nrow - 1) |
|
|
1912 | scr_changeview (top_row + (nrow - 1 - top_row) * y / len); |
1905 | } |
1913 | } |
1906 | |
1914 | |
1907 | /* ------------------------------------------------------------------------- */ |
1915 | /* ------------------------------------------------------------------------- */ |
1908 | /* |
1916 | /* |
1909 | * Page the screen up/down nlines |
1917 | * Page the screen up/down nlines |
1910 | * direction should be UP or DN |
1918 | * direction should be UP or DN |
1911 | */ |
1919 | */ |
1912 | bool |
1920 | bool |
1913 | rxvt_term::scr_page (enum page_dirn direction, int nlines) NOTHROW |
1921 | rxvt_term::scr_page (int nlines) noexcept |
1914 | { |
1922 | { |
1915 | int new_view_start = |
|
|
1916 | direction == UP ? view_start - nlines |
|
|
1917 | : view_start + nlines; |
|
|
1918 | |
|
|
1919 | return scr_changeview (new_view_start); |
1923 | return scr_changeview (view_start - nlines); |
1920 | } |
1924 | } |
1921 | |
1925 | |
1922 | bool |
1926 | bool |
1923 | rxvt_term::scr_changeview (int new_view_start) NOTHROW |
1927 | rxvt_term::scr_changeview (int new_view_start) noexcept |
1924 | { |
1928 | { |
1925 | clamp_it (new_view_start, top_row, 0); |
1929 | clamp_it (new_view_start, top_row, 0); |
1926 | |
1930 | |
1927 | if (new_view_start == view_start) |
1931 | if (new_view_start == view_start) |
1928 | return false; |
1932 | return false; |
… | |
… | |
1946 | } |
1950 | } |
1947 | #endif |
1951 | #endif |
1948 | |
1952 | |
1949 | /* ------------------------------------------------------------------------- */ |
1953 | /* ------------------------------------------------------------------------- */ |
1950 | void |
1954 | void |
1951 | rxvt_term::scr_bell () NOTHROW |
1955 | rxvt_term::scr_bell () noexcept |
1952 | { |
1956 | { |
1953 | #ifndef NO_BELL |
1957 | #ifndef NO_BELL |
1954 | |
1958 | |
1955 | # ifndef NO_MAPALERT |
1959 | # ifndef NO_MAPALERT |
1956 | # ifdef MAPALERT_OPTION |
1960 | # ifdef MAPALERT_OPTION |
… | |
… | |
1978 | #endif |
1982 | #endif |
1979 | } |
1983 | } |
1980 | |
1984 | |
1981 | /* ------------------------------------------------------------------------- */ |
1985 | /* ------------------------------------------------------------------------- */ |
1982 | void ecb_cold |
1986 | void ecb_cold |
1983 | rxvt_term::scr_printscreen (int fullhist) NOTHROW |
1987 | rxvt_term::scr_printscreen (int fullhist) noexcept |
1984 | { |
1988 | { |
1985 | #ifdef PRINTPIPE |
1989 | #ifdef PRINTPIPE |
1986 | int nrows, row_start; |
1990 | int nrows, row_start; |
1987 | FILE *fd = popen_printer (); |
1991 | FILE *fd = popen_printer (); |
1988 | |
1992 | |
… | |
… | |
2037 | * Refresh the screen |
2041 | * Refresh the screen |
2038 | * drawn_text/drawn_rend contain the screen information before the update. |
2042 | * drawn_text/drawn_rend contain the screen information before the update. |
2039 | * screen.text/screen.rend contain what the screen will change to. |
2043 | * screen.text/screen.rend contain what the screen will change to. |
2040 | */ |
2044 | */ |
2041 | void ecb_hot |
2045 | void ecb_hot |
2042 | rxvt_term::scr_refresh () NOTHROW |
2046 | rxvt_term::scr_refresh () noexcept |
2043 | { |
2047 | { |
2044 | int16_t col, row, /* column/row we're processing */ |
2048 | int16_t col, row, /* column/row we're processing */ |
2045 | ocrow; /* old cursor row */ |
2049 | ocrow; /* old cursor row */ |
2046 | int i; /* tmp */ |
2050 | int i; /* tmp */ |
2047 | rend_t ccol1, /* Cursor colour */ |
2051 | rend_t ccol1, /* Cursor colour */ |
2048 | ccol2; /* Cursor colour2 */ |
2052 | ccol2; /* Cursor colour2 */ |
2049 | rend_t cur_rend; |
2053 | rend_t cur_rend; |
2050 | int cur_col; |
2054 | int cur_col; |
|
|
2055 | int cursorwidth; |
2051 | |
2056 | |
2052 | want_refresh = 0; /* screen is current */ |
2057 | want_refresh = 0; /* screen is current */ |
2053 | |
2058 | |
2054 | if (refresh_type == NO_REFRESH || !mapped) |
2059 | if (refresh_type == NO_REFRESH || !mapped) |
2055 | return; |
2060 | return; |
… | |
… | |
2080 | |
2085 | |
2081 | /* |
2086 | /* |
2082 | * C: set the cursor character (s) |
2087 | * C: set the cursor character (s) |
2083 | */ |
2088 | */ |
2084 | { |
2089 | { |
2085 | bool setoldcursor; |
|
|
2086 | |
|
|
2087 | #ifdef CURSOR_BLINK |
2090 | #ifdef CURSOR_BLINK |
2088 | if (hidden_cursor) |
2091 | if (hidden_cursor) |
2089 | showcursor = 0; |
2092 | showcursor = 0; |
2090 | #endif |
2093 | #endif |
2091 | |
2094 | |
… | |
… | |
2093 | { |
2096 | { |
2094 | int col = screen.cur.col; |
2097 | int col = screen.cur.col; |
2095 | |
2098 | |
2096 | while (col && ROW(screen.cur.row).t[col] == NOCHAR) |
2099 | while (col && ROW(screen.cur.row).t[col] == NOCHAR) |
2097 | col--; |
2100 | col--; |
|
|
2101 | |
|
|
2102 | cursorwidth = 1; |
|
|
2103 | while (col + cursorwidth < ncol |
|
|
2104 | && ROW(screen.cur.row).t[col + cursorwidth] == NOCHAR) |
|
|
2105 | cursorwidth++; |
2098 | |
2106 | |
2099 | cur_rend = ROW(screen.cur.row).r[col]; |
2107 | cur_rend = ROW(screen.cur.row).r[col]; |
2100 | cur_col = col; |
2108 | cur_col = col; |
2101 | |
2109 | |
2102 | #ifndef NO_CURSORCOLOR |
2110 | #ifndef NO_CURSORCOLOR |
… | |
… | |
2119 | ccol2 = bgcolor_of (rstyle); |
2127 | ccol2 = bgcolor_of (rstyle); |
2120 | #else |
2128 | #else |
2121 | ccol2 = Color_bg; |
2129 | ccol2 = Color_bg; |
2122 | #endif |
2130 | #endif |
2123 | |
2131 | |
2124 | if (focus) |
2132 | if (focus && cursor_type == 0) |
2125 | { |
2133 | { |
2126 | rend_t rend = cur_rend; |
2134 | rend_t rend = cur_rend; |
2127 | |
2135 | |
2128 | if (option (Opt_cursorUnderline)) |
|
|
2129 | rend ^= RS_Uline; |
|
|
2130 | else |
|
|
2131 | { |
|
|
2132 | rend ^= RS_RVid; |
2136 | rend ^= RS_RVid; |
2133 | rend = SET_FGCOLOR (rend, ccol1); |
2137 | rend = SET_FGCOLOR (rend, ccol1); |
2134 | rend = SET_BGCOLOR (rend, ccol2); |
2138 | rend = SET_BGCOLOR (rend, ccol2); |
2135 | } |
|
|
2136 | |
2139 | |
2137 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2140 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2138 | } |
2141 | } |
2139 | } |
2142 | } |
2140 | |
2143 | |
2141 | /* make sure no outline cursor is left around */ |
2144 | /* make sure no outline cursor is left around */ |
2142 | setoldcursor = 0; |
2145 | if (ocrow != -1 && ocrow < nrow && oldcursor.col < ncol) |
2143 | if (ocrow != -1) |
2146 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
|
|
2147 | |
|
|
2148 | // save the current cursor coordinates if the cursor is visible |
|
|
2149 | // and either the window is unfocused or the cursor style is |
|
|
2150 | // underline or vertical bar, so as to clear the outline cursor in |
|
|
2151 | // the next refresh if the cursor moves or becomes invisible |
|
|
2152 | if (showcursor && (!focus || cursor_type != 0) && screen.cur.row - view_start < nrow) |
2144 | { |
2153 | { |
2145 | if (screen.cur.row - view_start != ocrow |
2154 | oldcursor.row = screen.cur.row - view_start; |
2146 | || screen.cur.col != oldcursor.col) |
2155 | oldcursor.col = screen.cur.col; |
2147 | { |
|
|
2148 | if (ocrow < nrow |
|
|
2149 | && oldcursor.col < ncol) |
|
|
2150 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
|
|
2151 | |
|
|
2152 | if (focus || !showcursor) |
|
|
2153 | oldcursor.row = -1; |
|
|
2154 | else |
|
|
2155 | setoldcursor = 1; |
|
|
2156 | } |
|
|
2157 | } |
2156 | } |
2158 | else if (!focus) |
2157 | else |
2159 | setoldcursor = 1; |
|
|
2160 | |
|
|
2161 | if (setoldcursor) |
|
|
2162 | { |
|
|
2163 | if (screen.cur.row - view_start >= nrow) |
|
|
2164 | oldcursor.row = -1; |
2158 | oldcursor.row = -1; |
2165 | else |
|
|
2166 | { |
|
|
2167 | oldcursor.row = screen.cur.row - view_start; |
|
|
2168 | oldcursor.col = screen.cur.col; |
|
|
2169 | } |
|
|
2170 | } |
|
|
2171 | } |
2159 | } |
2172 | |
2160 | |
2173 | #ifndef NO_SLOW_LINK_SUPPORT |
2161 | #ifndef NO_SLOW_LINK_SUPPORT |
2174 | /* |
2162 | /* |
2175 | * D: CopyArea pass - very useful for slower links |
2163 | * D: CopyArea pass - very useful for slower links |
… | |
… | |
2256 | int ypixel = (int)Row2Pixel (row); |
2244 | int ypixel = (int)Row2Pixel (row); |
2257 | |
2245 | |
2258 | for (col = 0; col < ncol; col++) |
2246 | for (col = 0; col < ncol; col++) |
2259 | { |
2247 | { |
2260 | /* compare new text with old - if exactly the same then continue */ |
2248 | /* compare new text with old - if exactly the same then continue */ |
2261 | if (stp[col] == dtp[col] /* Must match characters to skip. */ |
2249 | if (stp[col] == dtp[col] && RS_SAME (srp[col], drp[col])) |
2262 | && (RS_SAME (srp[col], drp[col]) /* Either rendition the same or */ |
|
|
2263 | || (stp[col] == ' ' /* space w/ no background change */ |
|
|
2264 | && GET_BGATTR (srp[col]) == GET_BGATTR (drp[col])))) |
|
|
2265 | continue; |
2250 | continue; |
2266 | |
2251 | |
2267 | // redraw one or more characters |
2252 | // redraw one or more characters |
2268 | |
2253 | |
2269 | // seek to the beginning of wide characters |
2254 | // seek to the beginning of wide characters |
… | |
… | |
2441 | else |
2426 | else |
2442 | font->draw (*drawable, xpixel, ypixel, text, count, fore, back); |
2427 | font->draw (*drawable, xpixel, ypixel, text, count, fore, back); |
2443 | |
2428 | |
2444 | if (ecb_unlikely (rend & RS_Uline && font->descent > 1 && fore != back)) |
2429 | if (ecb_unlikely (rend & RS_Uline && font->descent > 1 && fore != back)) |
2445 | { |
2430 | { |
|
|
2431 | if (showcursor && focus && row == screen.cur.row |
|
|
2432 | && IN_RANGE_EXC (col, cur_col, cur_col + cursorwidth)) |
|
|
2433 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
|
|
2434 | else |
2446 | #if ENABLE_FRILLS |
2435 | #if ENABLE_FRILLS |
2447 | if (ISSET_PIXCOLOR (Color_underline)) |
2436 | if (ISSET_PIXCOLOR (Color_underline)) |
2448 | XSetForeground (dpy, gc, pix_colors[Color_underline]); |
2437 | XSetForeground (dpy, gc, pix_colors[Color_underline]); |
2449 | else |
2438 | else |
2450 | #endif |
2439 | #endif |
… | |
… | |
2461 | * G: cleanup cursor and display outline cursor if necessary |
2450 | * G: cleanup cursor and display outline cursor if necessary |
2462 | */ |
2451 | */ |
2463 | if (showcursor) |
2452 | if (showcursor) |
2464 | { |
2453 | { |
2465 | if (focus) |
2454 | if (focus) |
|
|
2455 | { |
|
|
2456 | if (cursor_type == 0) |
2466 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
2457 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
|
|
2458 | else if (oldcursor.row >= 0) |
|
|
2459 | { |
|
|
2460 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
|
|
2461 | if (cursor_type == 1) |
|
|
2462 | XFillRectangle (dpy, vt, gc, |
|
|
2463 | Col2Pixel (cur_col), |
|
|
2464 | Row2Pixel (oldcursor.row + 1) - 2, |
|
|
2465 | Width2Pixel (1), |
|
|
2466 | 2); |
|
|
2467 | else |
|
|
2468 | XFillRectangle (dpy, vt, gc, |
|
|
2469 | Col2Pixel (cur_col), |
|
|
2470 | Row2Pixel (oldcursor.row), |
|
|
2471 | 2, |
|
|
2472 | Height2Pixel (1)); |
|
|
2473 | } |
|
|
2474 | } |
2467 | else if (oldcursor.row >= 0) |
2475 | else if (oldcursor.row >= 0) |
2468 | { |
2476 | { |
2469 | int cursorwidth = 1; |
|
|
2470 | int col = oldcursor.col; |
|
|
2471 | |
|
|
2472 | while (col && ROW(screen.cur.row).t[col] == NOCHAR) |
|
|
2473 | col--; |
|
|
2474 | |
|
|
2475 | while (col + cursorwidth < ncol |
|
|
2476 | && drawn_buf[oldcursor.row].t[col + cursorwidth] == NOCHAR) |
|
|
2477 | cursorwidth++; |
|
|
2478 | |
|
|
2479 | #ifndef NO_CURSORCOLOR |
|
|
2480 | if (ISSET_PIXCOLOR (Color_cursor)) |
|
|
2481 | XSetForeground (dpy, gc, pix_colors[Color_cursor]); |
|
|
2482 | else |
|
|
2483 | #endif |
|
|
2484 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2477 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2485 | |
2478 | |
2486 | XDrawRectangle (dpy, vt, gc, |
2479 | XDrawRectangle (dpy, vt, gc, |
2487 | Col2Pixel (col), |
2480 | Col2Pixel (cur_col), |
2488 | Row2Pixel (oldcursor.row), |
2481 | Row2Pixel (oldcursor.row), |
2489 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2482 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2490 | (unsigned int) (Height2Pixel (1) - 1)); |
2483 | (unsigned int) (Height2Pixel (1) - 1)); |
2491 | } |
2484 | } |
2492 | } |
2485 | } |
… | |
… | |
2505 | num_scr = 0; |
2498 | num_scr = 0; |
2506 | num_scr_allow = 1; |
2499 | num_scr_allow = 1; |
2507 | } |
2500 | } |
2508 | |
2501 | |
2509 | void ecb_cold |
2502 | void ecb_cold |
2510 | rxvt_term::scr_remap_chars (line_t &l) NOTHROW |
2503 | rxvt_term::scr_remap_chars (line_t &l) noexcept |
2511 | { |
2504 | { |
2512 | if (!l.valid ()) |
2505 | if (!l.valid ()) |
2513 | return; |
2506 | return; |
2514 | |
2507 | |
2515 | l.touch (); // maybe a bit of an overkill, but it's not performance-relevant |
2508 | l.touch (); // maybe a bit of an overkill, but it's not performance-relevant |
… | |
… | |
2517 | for (int i = ncol; i--; ) |
2510 | for (int i = ncol; i--; ) |
2518 | l.r[i] = SET_FONT (l.r[i], FONTSET (l.r[i])->find_font (l.t[i])); |
2511 | l.r[i] = SET_FONT (l.r[i], FONTSET (l.r[i])->find_font (l.t[i])); |
2519 | } |
2512 | } |
2520 | |
2513 | |
2521 | void ecb_cold |
2514 | void ecb_cold |
2522 | rxvt_term::scr_remap_chars () NOTHROW |
2515 | rxvt_term::scr_remap_chars () noexcept |
2523 | { |
2516 | { |
2524 | for (int i = total_rows; i--; ) |
2517 | for (int i = total_rows; i--; ) |
2525 | scr_remap_chars (row_buf [i]); |
2518 | scr_remap_chars (row_buf [i]); |
2526 | |
2519 | |
2527 | for (int i = nrow; i--; ) |
2520 | for (int i = nrow; i--; ) |
… | |
… | |
2530 | scr_remap_chars (swap_buf [i]); |
2523 | scr_remap_chars (swap_buf [i]); |
2531 | } |
2524 | } |
2532 | } |
2525 | } |
2533 | |
2526 | |
2534 | void ecb_cold |
2527 | void ecb_cold |
2535 | rxvt_term::scr_recolour (bool refresh) NOTHROW |
2528 | rxvt_term::scr_recolor (bool refresh) noexcept |
2536 | { |
2529 | { |
2537 | bool transparent = false; |
2530 | bool transparent = false; |
2538 | |
2531 | |
2539 | #ifdef HAVE_IMG |
2532 | #ifdef HAVE_IMG |
2540 | if (bg_img != 0) |
2533 | if (bg_img != 0) |
… | |
… | |
2561 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2554 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2562 | } |
2555 | } |
2563 | |
2556 | |
2564 | XClearWindow (dpy, parent); |
2557 | XClearWindow (dpy, parent); |
2565 | |
2558 | |
2566 | if (scrollBar.win) |
2559 | if (scrollBar.state && scrollBar.win) |
2567 | { |
2560 | { |
2568 | if (transparent) |
2561 | if (transparent) |
2569 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2562 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2570 | else |
2563 | else |
2571 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); |
2564 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); |
… | |
… | |
2581 | want_refresh = 1; |
2574 | want_refresh = 1; |
2582 | } |
2575 | } |
2583 | |
2576 | |
2584 | /* ------------------------------------------------------------------------- */ |
2577 | /* ------------------------------------------------------------------------- */ |
2585 | void |
2578 | void |
2586 | rxvt_term::scr_clear (bool really) NOTHROW |
2579 | rxvt_term::scr_clear (bool really) noexcept |
2587 | { |
2580 | { |
2588 | if (!mapped) |
2581 | if (!mapped) |
2589 | return; |
2582 | return; |
2590 | |
2583 | |
2591 | num_scr_allow = 0; |
2584 | num_scr_allow = 0; |
… | |
… | |
2594 | if (really) |
2587 | if (really) |
2595 | XClearWindow (dpy, vt); |
2588 | XClearWindow (dpy, vt); |
2596 | } |
2589 | } |
2597 | |
2590 | |
2598 | void |
2591 | void |
2599 | rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle1, rend_t rstyle2) NOTHROW |
2592 | rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle1, rend_t rstyle2) noexcept |
2600 | { |
2593 | { |
2601 | int view_end = view_start + nrow; |
2594 | int view_end = view_start + nrow; |
2602 | int row, col; |
2595 | int row, col; |
2603 | |
2596 | |
2604 | for (row = max (beg_row, view_start); row <= min (end_row, view_end); row++) |
2597 | for (row = max (beg_row, view_start); row <= min (end_row, view_end); row++) |
… | |
… | |
2616 | srp[col] ^= rstyle2; |
2609 | srp[col] ^= rstyle2; |
2617 | } |
2610 | } |
2618 | } |
2611 | } |
2619 | |
2612 | |
2620 | void |
2613 | void |
2621 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle) NOTHROW |
2614 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle) noexcept |
2622 | { |
2615 | { |
2623 | int view_end = view_start + nrow; |
2616 | int view_end = view_start + nrow; |
2624 | int row, col; |
2617 | int row, col; |
2625 | |
2618 | |
2626 | if (beg_row >= view_start) |
2619 | if (beg_row >= view_start) |
… | |
… | |
2643 | srp[col] ^= rstyle; |
2636 | srp[col] ^= rstyle; |
2644 | } |
2637 | } |
2645 | |
2638 | |
2646 | /* ------------------------------------------------------------------------- */ |
2639 | /* ------------------------------------------------------------------------- */ |
2647 | void ecb_hot |
2640 | void ecb_hot |
2648 | rxvt_term::scr_reverse_selection () NOTHROW |
2641 | rxvt_term::scr_reverse_selection () noexcept |
2649 | { |
2642 | { |
2650 | if (selection.op |
2643 | if (selection.op |
2651 | && current_screen == selection.screen |
2644 | && current_screen == selection.screen |
2652 | && selection.end.row >= view_start) |
2645 | && selection.end.row >= view_start) |
2653 | { |
2646 | { |
… | |
… | |
2669 | * Dump the whole scrollback and screen to the passed filedescriptor. The |
2662 | * Dump the whole scrollback and screen to the passed filedescriptor. The |
2670 | * invoking routine must close the fd. |
2663 | * invoking routine must close the fd. |
2671 | */ |
2664 | */ |
2672 | #if 0 |
2665 | #if 0 |
2673 | void |
2666 | void |
2674 | rxvt_term::scr_dump (int fd) NOTHROW |
2667 | rxvt_term::scr_dump (int fd) noexcept |
2675 | { |
2668 | { |
2676 | // if this method is needed, it can be implemented by factoring the |
2669 | // if this method is needed, it can be implemented by factoring the |
2677 | // relevant code in scr_printscreen |
2670 | // relevant code in scr_printscreen |
2678 | } |
2671 | } |
2679 | #endif |
2672 | #endif |
2680 | |
2673 | |
2681 | /* ------------------------------------------------------------------------- * |
2674 | /* ------------------------------------------------------------------------- * |
2682 | * CHARACTER SELECTION * |
2675 | * CHARACTER SELECTION * |
2683 | * ------------------------------------------------------------------------- */ |
2676 | * ------------------------------------------------------------------------- */ |
2684 | void |
2677 | void |
2685 | rxvt_term::selection_check (int check_more) NOTHROW |
2678 | rxvt_term::selection_check (int check_more) noexcept |
2686 | { |
2679 | { |
2687 | if (!selection.op) |
2680 | if (!selection.op) |
2688 | return; |
2681 | return; |
2689 | |
2682 | |
2690 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
2683 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
… | |
… | |
2696 | && ROWCOL_IS_BEFORE (screen.cur, selection.end))) |
2689 | && ROWCOL_IS_BEFORE (screen.cur, selection.end))) |
2697 | CLEAR_ALL_SELECTION (); |
2690 | CLEAR_ALL_SELECTION (); |
2698 | } |
2691 | } |
2699 | |
2692 | |
2700 | void |
2693 | void |
2701 | rxvt_term::selection_changed () NOTHROW |
2694 | rxvt_term::selection_changed () noexcept |
2702 | { |
2695 | { |
2703 | line_t &r1 = ROW (selection.beg.row); |
2696 | line_t &r1 = ROW (selection.beg.row); |
2704 | while (selection.beg.col > 0 && r1.t [selection.beg.col] == NOCHAR) |
2697 | while (selection.beg.col < r1.l && r1.t [selection.beg.col] == NOCHAR) |
2705 | --selection.beg.col; |
2698 | ++selection.beg.col; |
2706 | |
2699 | |
2707 | line_t &r2 = ROW (selection.end.row); |
2700 | line_t &r2 = ROW (selection.end.row); |
2708 | 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) |
2709 | ++selection.end.col; |
2702 | ++selection.end.col; |
2710 | |
2703 | |
… | |
… | |
2714 | /* ------------------------------------------------------------------------- */ |
2707 | /* ------------------------------------------------------------------------- */ |
2715 | /* |
2708 | /* |
2716 | * Paste a selection direct to the command fd |
2709 | * Paste a selection direct to the command fd |
2717 | */ |
2710 | */ |
2718 | void |
2711 | void |
2719 | rxvt_term::tt_paste (char *data, unsigned int len) NOTHROW |
2712 | rxvt_term::tt_paste (char *data, unsigned int len) noexcept |
2720 | { |
2713 | { |
2721 | /* convert normal newline chars into common keyboard Return key sequence */ |
2714 | /* convert normal newline chars into common keyboard Return key sequence */ |
2722 | for (unsigned int i = 0; i < len; i++) |
2715 | for (unsigned int i = 0; i < len; i++) |
2723 | if (data[i] == C0_LF) |
2716 | if (data[i] == C0_LF) |
2724 | data[i] = C0_CR; |
2717 | data[i] = C0_CR; |
2725 | |
2718 | |
2726 | if (priv_modes & PrivMode_BracketPaste) |
2719 | #if ENABLE_FRILLS |
|
|
2720 | if ((priv_modes & PrivMode_BracketPaste) && !option (Opt_disablePasteBrackets)) |
2727 | tt_printf ("\x1b[200~"); |
2721 | tt_printf ("\x1b[200~"); |
|
|
2722 | #endif |
2728 | |
2723 | |
2729 | tt_write (data, len); |
2724 | tt_write (data, len); |
2730 | |
2725 | |
2731 | if (priv_modes & PrivMode_BracketPaste) |
2726 | #if ENABLE_FRILLS |
|
|
2727 | if ((priv_modes & PrivMode_BracketPaste) && !option (Opt_disablePasteBrackets)) |
2732 | tt_printf ("\x1b[201~"); |
2728 | tt_printf ("\x1b[201~"); |
|
|
2729 | #endif |
2733 | } |
2730 | } |
2734 | |
2731 | |
2735 | void |
2732 | void |
2736 | rxvt_term::paste (char *data, unsigned int len) NOTHROW |
2733 | rxvt_term::paste (char *data, unsigned int len) noexcept |
2737 | { |
2734 | { |
2738 | if (HOOK_INVOKE ((this, HOOK_TT_PASTE, DT_STR_LEN, data, len, DT_END))) |
2735 | if (HOOK_INVOKE ((this, HOOK_TT_PASTE, DT_STR_LEN, data, len, DT_END))) |
2739 | return; |
2736 | return; |
2740 | |
2737 | |
2741 | tt_paste (data, len); |
2738 | tt_paste (data, len); |
… | |
… | |
2747 | * if the requested selection has no owner or is empty CUT_BUFFER0 is used |
2744 | * if the requested selection has no owner or is empty CUT_BUFFER0 is used |
2748 | * as fallback |
2745 | * as fallback |
2749 | * EXT: button 2 release |
2746 | * EXT: button 2 release |
2750 | */ |
2747 | */ |
2751 | void |
2748 | void |
2752 | rxvt_term::selection_request (Time tm, int selnum) NOTHROW |
2749 | rxvt_term::selection_request (Time tm, int selnum) noexcept |
2753 | { |
2750 | { |
2754 | if (!selection_req) |
2751 | if (!selection_req) |
2755 | { |
2752 | { |
2756 | selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this); |
2753 | selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this); |
2757 | selection_req->run (); |
2754 | selection_req->run (); |
… | |
… | |
2762 | /* |
2759 | /* |
2763 | * Clear all selected text |
2760 | * Clear all selected text |
2764 | * EXT: SelectionClear |
2761 | * EXT: SelectionClear |
2765 | */ |
2762 | */ |
2766 | void |
2763 | void |
2767 | rxvt_term::selection_clear (bool clipboard) NOTHROW |
2764 | rxvt_term::selection_clear (bool clipboard) noexcept |
2768 | { |
2765 | { |
2769 | if (!clipboard) |
2766 | if (!clipboard) |
2770 | { |
2767 | { |
2771 | want_refresh = 1; |
2768 | want_refresh = 1; |
2772 | free (selection.text); |
2769 | free (selection.text); |
… | |
… | |
2857 | if (*t == NOCHAR) |
2854 | if (*t == NOCHAR) |
2858 | t++; |
2855 | t++; |
2859 | #if ENABLE_COMBINING |
2856 | #if ENABLE_COMBINING |
2860 | else if (IS_COMPOSE (*t)) |
2857 | else if (IS_COMPOSE (*t)) |
2861 | { |
2858 | { |
2862 | int len = rxvt_composite.expand (*t, 0); |
2859 | int len = rxvt_composite.expand (*t); |
2863 | |
2860 | |
2864 | extra -= (len - 1); |
2861 | extra -= (len - 1); |
2865 | |
2862 | |
2866 | if (extra < 0) |
2863 | if (extra < 0) |
2867 | { |
2864 | { |
… | |
… | |
2914 | |
2911 | |
2915 | selection_grab (tm); |
2912 | selection_grab (tm); |
2916 | } |
2913 | } |
2917 | |
2914 | |
2918 | bool |
2915 | bool |
2919 | rxvt_term::selection_grab (Time tm, bool clipboard) NOTHROW |
2916 | rxvt_term::selection_grab (Time tm, bool clipboard) noexcept |
2920 | { |
2917 | { |
2921 | Atom sel; |
2918 | Atom sel; |
2922 | |
2919 | |
2923 | if (!clipboard) |
2920 | if (!clipboard) |
2924 | { |
2921 | { |
… | |
… | |
2958 | /* |
2955 | /* |
2959 | * Mark or select text based upon number of clicks: 1, 2, or 3 |
2956 | * Mark or select text based upon number of clicks: 1, 2, or 3 |
2960 | * EXT: button 1 press |
2957 | * EXT: button 1 press |
2961 | */ |
2958 | */ |
2962 | void ecb_cold |
2959 | void ecb_cold |
2963 | rxvt_term::selection_click (int clicks, int x, int y) NOTHROW |
2960 | rxvt_term::selection_click (int clicks, int x, int y) noexcept |
2964 | { |
2961 | { |
2965 | clicks = ((clicks - 1) % 3) + 1; |
2962 | clicks = ((clicks - 1) % 3) + 1; |
2966 | selection.clicks = clicks; /* save clicks so extend will work */ |
2963 | selection.clicks = clicks; /* save clicks so extend will work */ |
2967 | |
2964 | |
2968 | if (clicks == 2 && !selection.rect |
2965 | if (clicks == 2 && !selection.rect |
… | |
… | |
2987 | /* ------------------------------------------------------------------------- */ |
2984 | /* ------------------------------------------------------------------------- */ |
2988 | /* |
2985 | /* |
2989 | * Mark a selection at the specified col/row |
2986 | * Mark a selection at the specified col/row |
2990 | */ |
2987 | */ |
2991 | void ecb_cold |
2988 | void ecb_cold |
2992 | rxvt_term::selection_start_colrow (int col, int row) NOTHROW |
2989 | rxvt_term::selection_start_colrow (int col, int row) noexcept |
2993 | { |
2990 | { |
2994 | want_refresh = 1; |
2991 | want_refresh = 1; |
2995 | |
2992 | |
2996 | selection.mark.row = row + view_start; |
2993 | selection.mark.row = row + view_start; |
2997 | selection.mark.col = col; |
2994 | selection.mark.col = col; |
… | |
… | |
3024 | #define DELIMIT_TEXT(x) \ |
3021 | #define DELIMIT_TEXT(x) \ |
3025 | (unicode::is_space (x) ? 2 : (x) <= 0xff && !!strchr (rs[Rs_cutchars], (x))) |
3022 | (unicode::is_space (x) ? 2 : (x) <= 0xff && !!strchr (rs[Rs_cutchars], (x))) |
3026 | #define DELIMIT_REND(x) 1 |
3023 | #define DELIMIT_REND(x) 1 |
3027 | |
3024 | |
3028 | void ecb_cold |
3025 | void ecb_cold |
3029 | rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) NOTHROW |
3026 | rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) noexcept |
3030 | { |
3027 | { |
3031 | int col, row, dirnadd, tcol, trow, w1, w2; |
3028 | int col, row, dirnadd, tcol, trow, w1, w2; |
3032 | row_col_t bound; |
3029 | row_col_t bound; |
3033 | text_t *stp; |
3030 | text_t *stp; |
3034 | rend_t *srp; |
3031 | rend_t *srp; |
… | |
… | |
3108 | * flag == 0 ==> button 1 |
3105 | * flag == 0 ==> button 1 |
3109 | * flag == 1 ==> button 3 press |
3106 | * flag == 1 ==> button 3 press |
3110 | * flag == 2 ==> button 3 motion |
3107 | * flag == 2 ==> button 3 motion |
3111 | */ |
3108 | */ |
3112 | void ecb_cold |
3109 | void ecb_cold |
3113 | rxvt_term::selection_extend (int x, int y, int flag) NOTHROW |
3110 | rxvt_term::selection_extend (int x, int y, int flag) noexcept |
3114 | { |
3111 | { |
3115 | int col = clamp (Pixel2Col (x), 0, ncol); |
3112 | int col = clamp (Pixel2Col (x), 0, ncol); |
3116 | int row = clamp (Pixel2Row (y), 0, nrow - 1); |
3113 | int row = clamp (Pixel2Row (y), 0, nrow - 1); |
3117 | |
3114 | |
3118 | /* |
3115 | /* |
… | |
… | |
3144 | /* ------------------------------------------------------------------------- */ |
3141 | /* ------------------------------------------------------------------------- */ |
3145 | /* |
3142 | /* |
3146 | * Extend the selection to the specified col/row |
3143 | * Extend the selection to the specified col/row |
3147 | */ |
3144 | */ |
3148 | void ecb_cold |
3145 | void ecb_cold |
3149 | rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) NOTHROW |
3146 | rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) noexcept |
3150 | { |
3147 | { |
3151 | row_col_t pos; |
3148 | row_col_t pos; |
3152 | enum { |
3149 | enum { |
3153 | LEFT, RIGHT |
3150 | LEFT, RIGHT |
3154 | } closeto = RIGHT; |
3151 | } closeto = RIGHT; |
… | |
… | |
3345 | selection_changed (); |
3342 | selection_changed (); |
3346 | } |
3343 | } |
3347 | |
3344 | |
3348 | #if !ENABLE_MINIMAL |
3345 | #if !ENABLE_MINIMAL |
3349 | void ecb_cold |
3346 | void ecb_cold |
3350 | rxvt_term::selection_remove_trailing_spaces () NOTHROW |
3347 | rxvt_term::selection_remove_trailing_spaces () noexcept |
3351 | { |
3348 | { |
3352 | int32_t end_col, end_row; |
3349 | int32_t end_col, end_row; |
3353 | text_t *stp; |
3350 | text_t *stp; |
3354 | |
3351 | |
3355 | end_col = selection.end.col; |
3352 | end_col = selection.end.col; |
… | |
… | |
3393 | /* |
3390 | /* |
3394 | * Double click on button 3 when already selected |
3391 | * Double click on button 3 when already selected |
3395 | * EXT: button 3 double click |
3392 | * EXT: button 3 double click |
3396 | */ |
3393 | */ |
3397 | void ecb_cold |
3394 | void ecb_cold |
3398 | rxvt_term::selection_rotate (int x, int y) NOTHROW |
3395 | rxvt_term::selection_rotate (int x, int y) noexcept |
3399 | { |
3396 | { |
3400 | selection.clicks = selection.clicks % 3 + 1; |
3397 | selection.clicks = selection.clicks % 3 + 1; |
3401 | selection_extend_colrow (Pixel2Col (x), Pixel2Row (y), 1, 0, 1); |
3398 | selection_extend_colrow (Pixel2Col (x), Pixel2Row (y), 1, 0, 1); |
3402 | } |
3399 | } |
3403 | |
3400 | |
… | |
… | |
3405 | /* |
3402 | /* |
3406 | * Respond to a request for our current selection |
3403 | * Respond to a request for our current selection |
3407 | * EXT: SelectionRequest |
3404 | * EXT: SelectionRequest |
3408 | */ |
3405 | */ |
3409 | void ecb_cold |
3406 | void ecb_cold |
3410 | rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW |
3407 | rxvt_term::selection_send (const XSelectionRequestEvent &rq) noexcept |
3411 | { |
3408 | { |
3412 | Atom property = rq.property == None ? rq.target : rq.property; |
3409 | Atom property = rq.property == None ? rq.target : rq.property; |
3413 | XSelectionEvent ev; |
3410 | XSelectionEvent ev; |
3414 | |
3411 | |
3415 | ev.type = SelectionNotify; |
3412 | ev.type = SelectionNotify; |
… | |
… | |
3507 | cl = selection.clip_text; |
3504 | cl = selection.clip_text; |
3508 | selectlen = selection.clip_len; |
3505 | selectlen = selection.clip_len; |
3509 | } |
3506 | } |
3510 | else |
3507 | else |
3511 | { |
3508 | { |
3512 | cl = L""; |
3509 | cl = (wchar_t *)L""; |
3513 | selectlen = 0; |
3510 | selectlen = 0; |
3514 | } |
3511 | } |
3515 | |
3512 | |
3516 | #if !ENABLE_MINIMAL |
3513 | #if !ENABLE_MINIMAL |
3517 | // xlib is horribly broken with respect to UTF8_STRING, and nobody cares to fix it |
3514 | // xlib is horribly broken with respect to UTF8_STRING, and nobody cares to fix it |
… | |
… | |
3549 | } |
3546 | } |
3550 | |
3547 | |
3551 | /* ------------------------------------------------------------------------- */ |
3548 | /* ------------------------------------------------------------------------- */ |
3552 | #if USE_XIM |
3549 | #if USE_XIM |
3553 | void ecb_cold |
3550 | void ecb_cold |
3554 | rxvt_term::im_set_position (XPoint &pos) NOTHROW |
3551 | rxvt_term::im_set_position (XPoint &pos) noexcept |
3555 | { |
3552 | { |
3556 | XWindowAttributes xwa; |
3553 | XWindowAttributes xwa; |
3557 | |
3554 | |
3558 | XGetWindowAttributes (dpy, vt, &xwa); |
3555 | XGetWindowAttributes (dpy, vt, &xwa); |
3559 | |
3556 | |
… | |
… | |
3562 | } |
3559 | } |
3563 | #endif |
3560 | #endif |
3564 | |
3561 | |
3565 | #if ENABLE_OVERLAY |
3562 | #if ENABLE_OVERLAY |
3566 | void |
3563 | void |
3567 | rxvt_term::scr_overlay_new (int x, int y, int w, int h) NOTHROW |
3564 | rxvt_term::scr_overlay_new (int x, int y, int w, int h) noexcept |
3568 | { |
3565 | { |
3569 | if (nrow < 1 || ncol < 1) |
3566 | if (nrow < 1 || ncol < 1) |
3570 | return; |
3567 | return; |
3571 | |
3568 | |
3572 | want_refresh = 1; |
3569 | want_refresh = 1; |
… | |
… | |
3617 | *rp = r; |
3614 | *rp = r; |
3618 | } |
3615 | } |
3619 | } |
3616 | } |
3620 | |
3617 | |
3621 | void |
3618 | void |
3622 | rxvt_term::scr_overlay_off () NOTHROW |
3619 | rxvt_term::scr_overlay_off () noexcept |
3623 | { |
3620 | { |
3624 | if (!ov.text) |
3621 | if (!ov.text) |
3625 | return; |
3622 | return; |
3626 | |
3623 | |
3627 | want_refresh = 1; |
3624 | want_refresh = 1; |
… | |
… | |
3635 | delete [] ov.text; ov.text = 0; |
3632 | delete [] ov.text; ov.text = 0; |
3636 | delete [] ov.rend; ov.rend = 0; |
3633 | delete [] ov.rend; ov.rend = 0; |
3637 | } |
3634 | } |
3638 | |
3635 | |
3639 | void |
3636 | void |
3640 | rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW |
3637 | rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) noexcept |
3641 | { |
3638 | { |
3642 | if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2) |
3639 | if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2) |
3643 | return; |
3640 | return; |
3644 | |
3641 | |
3645 | x++, y++; |
3642 | x++, y++; |
… | |
… | |
3647 | ov.text[y][x] = text; |
3644 | ov.text[y][x] = text; |
3648 | ov.rend[y][x] = rend; |
3645 | ov.rend[y][x] = rend; |
3649 | } |
3646 | } |
3650 | |
3647 | |
3651 | void |
3648 | void |
3652 | rxvt_term::scr_overlay_set (int x, int y, const char *s) NOTHROW |
3649 | rxvt_term::scr_overlay_set (int x, int y, const char *s) noexcept |
3653 | { |
3650 | { |
3654 | while (*s) |
3651 | while (*s) |
3655 | scr_overlay_set (x++, y, *s++); |
3652 | scr_overlay_set (x++, y, *s++); |
3656 | } |
3653 | } |
3657 | |
3654 | |
3658 | void |
3655 | void |
3659 | rxvt_term::scr_overlay_set (int x, int y, const wchar_t *s) NOTHROW |
3656 | rxvt_term::scr_overlay_set (int x, int y, const wchar_t *s) noexcept |
3660 | { |
3657 | { |
3661 | while (*s) |
3658 | while (*s) |
3662 | { |
3659 | { |
3663 | text_t t = *s++; |
3660 | text_t t = *s++; |
3664 | int width = WCWIDTH (t); |
3661 | int width = WCWIDTH (t); |
… | |
… | |
3670 | } |
3667 | } |
3671 | } |
3668 | } |
3672 | } |
3669 | } |
3673 | |
3670 | |
3674 | void |
3671 | void |
3675 | rxvt_term::scr_swap_overlay () NOTHROW |
3672 | rxvt_term::scr_swap_overlay () noexcept |
3676 | { |
3673 | { |
3677 | if (!ov.text) |
3674 | if (!ov.text) |
3678 | return; |
3675 | return; |
3679 | |
3676 | |
3680 | // hide cursor if it is within the overlay area |
3677 | // hide cursor if it is within the overlay area |