… | |
… | |
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 |
… | |
… | |
290 | * add or delete rows as appropriate |
291 | * add or delete rows as appropriate |
291 | */ |
292 | */ |
292 | |
293 | |
293 | int common_col = min (prev_ncol, ncol); |
294 | int common_col = min (prev_ncol, ncol); |
294 | |
295 | |
|
|
296 | // resize swap_buf, blank drawn_buf |
295 | for (int row = min (nrow, prev_nrow); row--; ) |
297 | for (int row = min (nrow, prev_nrow); row--; ) |
296 | { |
298 | { |
297 | scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); |
299 | scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); |
298 | memcpy (drawn_buf [row].t, prev_drawn_buf [row].t, sizeof (text_t) * common_col); |
300 | memcpy (drawn_buf [row].t, prev_drawn_buf [row].t, sizeof (text_t) * common_col); |
299 | memcpy (drawn_buf [row].r, prev_drawn_buf [row].r, sizeof (rend_t) * common_col); |
301 | memcpy (drawn_buf [row].r, prev_drawn_buf [row].r, sizeof (rend_t) * common_col); |
… | |
… | |
303 | |
305 | |
304 | int p = MOD (term_start + prev_nrow, prev_total_rows); // previous row |
306 | int p = MOD (term_start + prev_nrow, prev_total_rows); // previous row |
305 | int pend = MOD (term_start + top_row , prev_total_rows); |
307 | int pend = MOD (term_start + top_row , prev_total_rows); |
306 | int q = total_rows; // rewrapped row |
308 | int q = total_rows; // rewrapped row |
307 | |
309 | |
308 | if (top_row) |
310 | #if ENABLE_FRILLS |
|
|
311 | if ((rewrap_always || top_row) && !rewrap_never) |
309 | { |
312 | { |
310 | // Re-wrap lines. This is rather ugly, possibly because I am too dumb |
313 | // Re-wrap lines. This is rather ugly, possibly because I am too dumb |
311 | // to come up with a lean and mean algorithm. |
314 | // to come up with a lean and mean algorithm. |
312 | // TODO: maybe optimise when width didn't change |
315 | // TODO: maybe optimise when width didn't change |
313 | |
316 | |
… | |
… | |
384 | qline->l = llen ? MOD (llen - 1, ncol) + 1 : 0; |
387 | qline->l = llen ? MOD (llen - 1, ncol) + 1 : 0; |
385 | qline->is_longer (0); |
388 | qline->is_longer (0); |
386 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
389 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
387 | } |
390 | } |
388 | while (p != pend && q > 0); |
391 | while (p != pend && q > 0); |
389 | |
|
|
390 | term_start = total_rows - nrow; |
|
|
391 | top_row = q - term_start; |
|
|
392 | |
|
|
393 | // make sure all terminal lines exist |
|
|
394 | while (top_row > 0) |
|
|
395 | scr_blank_screen_mem (ROW (--top_row), DEFAULT_RSTYLE); |
|
|
396 | } |
392 | } |
397 | else |
393 | else |
|
|
394 | #endif |
|
|
395 | { |
|
|
396 | // wing, instead of wrap |
|
|
397 | screen.cur.row += nrow - prev_nrow; |
|
|
398 | |
398 | { |
399 | do |
399 | // if no scrollback exists (yet), wing, instead of wrap |
|
|
400 | |
|
|
401 | for (int row = min (nrow, prev_nrow); row--; ) |
|
|
402 | { |
400 | { |
403 | line_t &src = prev_row_buf [MOD (term_start + row, prev_total_rows)]; |
401 | p = MOD (p - 1, prev_total_rows); |
404 | line_t &dst = row_buf [row]; |
402 | q--; |
405 | |
403 | |
406 | copy_line (dst, src); |
404 | copy_line (row_buf [q], prev_row_buf [p]); |
407 | } |
405 | } |
|
|
406 | while (p != pend && q > 0); |
408 | |
407 | |
409 | for (int row = prev_nrow; row < nrow; row++) |
408 | } |
|
|
409 | |
|
|
410 | term_start = total_rows - nrow; |
|
|
411 | top_row = q - term_start; |
|
|
412 | |
|
|
413 | // make sure all terminal lines exist |
|
|
414 | while (top_row > 0) |
410 | scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); |
415 | scr_blank_screen_mem (ROW (--top_row), DEFAULT_RSTYLE); |
411 | |
|
|
412 | term_start = 0; |
|
|
413 | } |
|
|
414 | |
416 | |
415 | clamp_it (screen.cur.row, 0, nrow - 1); |
417 | clamp_it (screen.cur.row, 0, nrow - 1); |
416 | clamp_it (screen.cur.col, 0, ncol - 1); |
418 | clamp_it (screen.cur.col, 0, ncol - 1); |
417 | } |
419 | } |
418 | |
420 | |
|
|
421 | // ensure drawn_buf, swap_buf and terminal rows are all initialized |
419 | for (int row = nrow; row--; ) |
422 | for (int row = nrow; row--; ) |
420 | { |
423 | { |
421 | if (!ROW (row).valid ()) scr_blank_screen_mem (ROW (row), DEFAULT_RSTYLE); |
424 | if (!ROW (row).valid ()) scr_blank_screen_mem (ROW (row), DEFAULT_RSTYLE); |
422 | if (!swap_buf [row].valid ()) scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE); |
425 | if (!swap_buf [row].valid ()) scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE); |
423 | if (!drawn_buf [row].valid ()) scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); |
426 | if (!drawn_buf [row].valid ()) scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); |
… | |
… | |
440 | |
443 | |
441 | HOOK_INVOKE ((this, HOOK_RESET, DT_END)); |
444 | HOOK_INVOKE ((this, HOOK_RESET, DT_END)); |
442 | } |
445 | } |
443 | |
446 | |
444 | void ecb_cold |
447 | void ecb_cold |
445 | rxvt_term::scr_release () NOTHROW |
448 | rxvt_term::scr_release () noexcept |
446 | { |
449 | { |
447 | chunk_free (chunk, chunk_size); |
450 | chunk_free (chunk, chunk_size); |
448 | chunk = 0; |
451 | chunk = 0; |
449 | row_buf = 0; |
452 | row_buf = 0; |
450 | |
453 | |
… | |
… | |
469 | scr_clear (true); |
472 | scr_clear (true); |
470 | scr_refresh (); |
473 | scr_refresh (); |
471 | } |
474 | } |
472 | |
475 | |
473 | void ecb_cold |
476 | void ecb_cold |
474 | rxvt_term::scr_soft_reset () NOTHROW |
477 | rxvt_term::scr_soft_reset () noexcept |
475 | { |
478 | { |
476 | /* only affects modes, nothing drastic such as clearing the screen */ |
479 | /* only affects modes, nothing drastic such as clearing the screen */ |
477 | #if ENABLE_OVERLAY |
480 | #if ENABLE_OVERLAY |
478 | scr_overlay_off (); |
481 | scr_overlay_off (); |
479 | #endif |
482 | #endif |
… | |
… | |
493 | * Save and Restore cursor |
496 | * Save and Restore cursor |
494 | * XTERM_SEQ: Save cursor : ESC 7 |
497 | * XTERM_SEQ: Save cursor : ESC 7 |
495 | * XTERM_SEQ: Restore cursor: ESC 8 |
498 | * XTERM_SEQ: Restore cursor: ESC 8 |
496 | */ |
499 | */ |
497 | void |
500 | void |
498 | rxvt_term::scr_cursor (cursor_mode mode) NOTHROW |
501 | rxvt_term::scr_cursor (cursor_mode mode) noexcept |
499 | { |
502 | { |
500 | screen_t *s; |
503 | screen_t *s; |
501 | |
504 | |
502 | #if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) |
505 | #if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) |
503 | if (current_screen == SECONDARY) |
506 | if (current_screen == SECONDARY) |
… | |
… | |
534 | assert (s->cur.row >= 0); |
537 | assert (s->cur.row >= 0); |
535 | assert (s->cur.col >= 0); |
538 | assert (s->cur.col >= 0); |
536 | } |
539 | } |
537 | |
540 | |
538 | void |
541 | void |
539 | rxvt_term::scr_swap_screen () NOTHROW |
542 | rxvt_term::scr_swap_screen () noexcept |
540 | { |
543 | { |
541 | if (!option (Opt_secondaryScreen)) |
544 | if (!option (Opt_secondaryScreen)) |
542 | return; |
545 | return; |
543 | |
546 | |
544 | for (int i = prev_nrow; i--; ) |
547 | for (int i = prev_nrow; i--; ) |
… | |
… | |
592 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
595 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
593 | } |
596 | } |
594 | |
597 | |
595 | // clear WrapNext indicator, solidifying position on next line |
598 | // clear WrapNext indicator, solidifying position on next line |
596 | void |
599 | void |
597 | rxvt_term::scr_do_wrap () NOTHROW |
600 | rxvt_term::scr_do_wrap () noexcept |
598 | { |
601 | { |
599 | if (!(screen.flags & Screen_WrapNext)) |
602 | if (!(screen.flags & Screen_WrapNext)) |
600 | return; |
603 | return; |
601 | |
604 | |
602 | screen.flags &= ~Screen_WrapNext; |
605 | screen.flags &= ~Screen_WrapNext; |
… | |
… | |
612 | /* ------------------------------------------------------------------------- */ |
615 | /* ------------------------------------------------------------------------- */ |
613 | /* |
616 | /* |
614 | * Change the colour for following text |
617 | * Change the colour for following text |
615 | */ |
618 | */ |
616 | void |
619 | void |
617 | rxvt_term::scr_color (unsigned int color, int fgbg) NOTHROW |
620 | rxvt_term::scr_color (unsigned int color, int fgbg) noexcept |
618 | { |
621 | { |
619 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
622 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR24)) |
620 | color = fgbg; |
623 | color = fgbg; |
621 | |
624 | |
622 | if (fgbg == Color_fg) |
625 | if (fgbg == Color_fg) |
623 | rstyle = SET_FGCOLOR (rstyle, color); |
626 | rstyle = SET_FGCOLOR (rstyle, color); |
624 | else |
627 | else |
… | |
… | |
628 | /* ------------------------------------------------------------------------- */ |
631 | /* ------------------------------------------------------------------------- */ |
629 | /* |
632 | /* |
630 | * Change the rendition style for following text |
633 | * Change the rendition style for following text |
631 | */ |
634 | */ |
632 | void |
635 | void |
633 | rxvt_term::scr_rendition (int set, int style) NOTHROW |
636 | rxvt_term::scr_rendition (int set, int style) noexcept |
634 | { |
637 | { |
635 | if (set) |
638 | if (set) |
636 | rstyle |= style; |
639 | rstyle |= style; |
637 | else if (style == ~RS_None) |
640 | else if (style == ~RS_None) |
638 | rstyle = DEFAULT_RSTYLE; |
641 | rstyle = DEFAULT_RSTYLE; |
… | |
… | |
645 | * Scroll text between <row1> and <row2> inclusive, by <count> lines |
648 | * Scroll text between <row1> and <row2> inclusive, by <count> lines |
646 | * count positive ==> scroll up |
649 | * count positive ==> scroll up |
647 | * count negative ==> scroll down |
650 | * count negative ==> scroll down |
648 | */ |
651 | */ |
649 | int ecb_hot |
652 | int ecb_hot |
650 | rxvt_term::scr_scroll_text (int row1, int row2, int count) NOTHROW |
653 | rxvt_term::scr_scroll_text (int row1, int row2, int count) noexcept |
651 | { |
654 | { |
652 | if (count == 0 || (row1 > row2)) |
655 | if (count == 0 || (row1 > row2)) |
653 | return 0; |
656 | return 0; |
654 | |
657 | |
655 | want_refresh = 1; |
658 | want_refresh = 1; |
… | |
… | |
715 | |
718 | |
716 | // finally move the view window, if desired |
719 | // finally move the view window, if desired |
717 | if (option (Opt_scrollWithBuffer) |
720 | if (option (Opt_scrollWithBuffer) |
718 | && view_start != 0 |
721 | && view_start != 0 |
719 | && view_start != -saveLines) |
722 | && view_start != -saveLines) |
720 | scr_page (UP, count); |
723 | scr_page (count); |
721 | |
724 | |
722 | if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) |
725 | if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) |
723 | HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, top_row, DT_END)); |
726 | HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, top_row, DT_END)); |
724 | } |
727 | } |
725 | else |
728 | else |
… | |
… | |
789 | /* ------------------------------------------------------------------------- */ |
792 | /* ------------------------------------------------------------------------- */ |
790 | /* |
793 | /* |
791 | * Add text given in <str> of length <len> to screen struct |
794 | * Add text given in <str> of length <len> to screen struct |
792 | */ |
795 | */ |
793 | void ecb_hot |
796 | void ecb_hot |
794 | rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) NOTHROW |
797 | rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) noexcept |
795 | { |
798 | { |
796 | if (len <= 0) /* sanity */ |
799 | if (len <= 0) /* sanity */ |
797 | return; |
800 | return; |
798 | |
801 | |
799 | bool checksel; |
802 | bool checksel; |
… | |
… | |
1011 | } |
1014 | } |
1012 | else if (screen.cur.row > 0 |
1015 | else if (screen.cur.row > 0 |
1013 | && ROW(screen.cur.row - 1).is_longer ()) |
1016 | && ROW(screen.cur.row - 1).is_longer ()) |
1014 | { |
1017 | { |
1015 | linep = &ROW(screen.cur.row - 1); |
1018 | linep = &ROW(screen.cur.row - 1); |
1016 | tp = line->t + ncol - 1; |
1019 | tp = linep->t + ncol - 1; |
1017 | rp = line->r + ncol - 1; |
1020 | rp = linep->r + ncol - 1; |
1018 | } |
1021 | } |
1019 | else |
1022 | else |
1020 | continue; |
1023 | continue; |
1021 | |
1024 | |
1022 | linep->touch (); |
1025 | linep->touch (); |
… | |
… | |
1045 | /* |
1048 | /* |
1046 | * Process Backspace. Move back the cursor back a position, wrap if have to |
1049 | * Process Backspace. Move back the cursor back a position, wrap if have to |
1047 | * XTERM_SEQ: CTRL-H |
1050 | * XTERM_SEQ: CTRL-H |
1048 | */ |
1051 | */ |
1049 | void |
1052 | void |
1050 | rxvt_term::scr_backspace () NOTHROW |
1053 | rxvt_term::scr_backspace () noexcept |
1051 | { |
1054 | { |
1052 | if (screen.cur.col == 0) |
1055 | if (screen.cur.col == 0) |
1053 | { |
1056 | { |
1054 | if (screen.cur.row > 0) |
1057 | if (screen.cur.row > 0) |
1055 | { |
1058 | { |
… | |
… | |
1072 | * Process Horizontal Tab |
1075 | * Process Horizontal Tab |
1073 | * count: +ve = forward; -ve = backwards |
1076 | * count: +ve = forward; -ve = backwards |
1074 | * XTERM_SEQ: CTRL-I |
1077 | * XTERM_SEQ: CTRL-I |
1075 | */ |
1078 | */ |
1076 | void |
1079 | void |
1077 | rxvt_term::scr_tab (int count, bool ht) NOTHROW |
1080 | rxvt_term::scr_tab (int count, bool ht) noexcept |
1078 | { |
1081 | { |
1079 | int i, x; |
1082 | int i, x; |
1080 | |
1083 | |
1081 | want_refresh = 1; |
1084 | want_refresh = 1; |
1082 | i = x = screen.cur.col; |
1085 | i = x = screen.cur.col; |
… | |
… | |
1149 | * Move cursor left in row. If we're at the left boundary, shift everything |
1152 | * Move cursor left in row. If we're at the left boundary, shift everything |
1150 | * in that row right. Clear left column. |
1153 | * in that row right. Clear left column. |
1151 | */ |
1154 | */ |
1152 | #if !ENABLE_MINIMAL |
1155 | #if !ENABLE_MINIMAL |
1153 | void ecb_cold |
1156 | void ecb_cold |
1154 | rxvt_term::scr_backindex () NOTHROW |
1157 | rxvt_term::scr_backindex () noexcept |
1155 | { |
1158 | { |
1156 | if (screen.cur.col > 0) |
1159 | if (screen.cur.col > 0) |
1157 | scr_gotorc (0, -1, R_RELATIVE | C_RELATIVE); |
1160 | scr_gotorc (0, -1, R_RELATIVE | C_RELATIVE); |
1158 | else |
1161 | else |
1159 | scr_insdel_chars (1, INSERT); |
1162 | scr_insdel_chars (1, INSERT); |
… | |
… | |
1166 | * Move cursor right in row. If we're at the right boundary, shift everything |
1169 | * Move cursor right in row. If we're at the right boundary, shift everything |
1167 | * in that row left. Clear right column. |
1170 | * in that row left. Clear right column. |
1168 | */ |
1171 | */ |
1169 | #if !ENABLE_MINIMAL |
1172 | #if !ENABLE_MINIMAL |
1170 | void ecb_cold |
1173 | void ecb_cold |
1171 | rxvt_term::scr_forwardindex () NOTHROW |
1174 | rxvt_term::scr_forwardindex () noexcept |
1172 | { |
1175 | { |
1173 | if (screen.cur.col < ncol - 1) |
1176 | if (screen.cur.col < ncol - 1) |
1174 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1177 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1175 | else |
1178 | else |
1176 | { |
1179 | { |
… | |
… | |
1189 | /* ------------------------------------------------------------------------- */ |
1192 | /* ------------------------------------------------------------------------- */ |
1190 | /* |
1193 | /* |
1191 | * Goto Row/Column |
1194 | * Goto Row/Column |
1192 | */ |
1195 | */ |
1193 | void |
1196 | void |
1194 | rxvt_term::scr_gotorc (int row, int col, int relative) NOTHROW |
1197 | rxvt_term::scr_gotorc (int row, int col, int relative) noexcept |
1195 | { |
1198 | { |
1196 | want_refresh = 1; |
1199 | want_refresh = 1; |
1197 | ZERO_SCROLLBACK (); |
1200 | ZERO_SCROLLBACK (); |
1198 | |
1201 | |
1199 | screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; |
1202 | screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; |
… | |
… | |
1238 | /* ------------------------------------------------------------------------- */ |
1241 | /* ------------------------------------------------------------------------- */ |
1239 | /* |
1242 | /* |
1240 | * direction should be UP or DN |
1243 | * direction should be UP or DN |
1241 | */ |
1244 | */ |
1242 | void |
1245 | void |
1243 | rxvt_term::scr_index (enum page_dirn direction) NOTHROW |
1246 | rxvt_term::scr_index (enum page_dirn direction) noexcept |
1244 | { |
1247 | { |
1245 | int dirn; |
|
|
1246 | |
|
|
1247 | want_refresh = 1; |
1248 | want_refresh = 1; |
1248 | ZERO_SCROLLBACK (); |
1249 | ZERO_SCROLLBACK (); |
1249 | |
1250 | |
1250 | dirn = ((direction == UP) ? 1 : -1); |
|
|
1251 | |
|
|
1252 | screen.flags &= ~Screen_WrapNext; |
1251 | screen.flags &= ~Screen_WrapNext; |
1253 | |
1252 | |
1254 | if ((screen.cur.row == screen.bscroll && direction == UP) |
1253 | if ((screen.cur.row == screen.bscroll && direction == UP) |
1255 | || (screen.cur.row == screen.tscroll && direction == DN)) |
1254 | || (screen.cur.row == screen.tscroll && direction == DN)) |
1256 | scr_scroll_text (screen.tscroll, screen.bscroll, dirn); |
1255 | scr_scroll_text (screen.tscroll, screen.bscroll, direction); |
1257 | else |
1256 | else |
1258 | screen.cur.row += dirn; |
1257 | screen.cur.row += direction; |
1259 | |
1258 | |
1260 | clamp_it (screen.cur.row, 0, nrow - 1); |
1259 | clamp_it (screen.cur.row, 0, nrow - 1); |
1261 | selection_check (0); |
1260 | selection_check (0); |
1262 | } |
1261 | } |
1263 | |
1262 | |
… | |
… | |
1268 | * XTERM_SEQ: Clear line to left : ESC [ 1 K |
1267 | * XTERM_SEQ: Clear line to left : ESC [ 1 K |
1269 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1268 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1270 | * extension: clear to right unless wrapped: ESC [ 3 K |
1269 | * extension: clear to right unless wrapped: ESC [ 3 K |
1271 | */ |
1270 | */ |
1272 | void |
1271 | void |
1273 | rxvt_term::scr_erase_line (int mode) NOTHROW |
1272 | rxvt_term::scr_erase_line (int mode) noexcept |
1274 | { |
1273 | { |
1275 | unsigned int col, num; |
1274 | unsigned int col, num; |
1276 | |
1275 | |
1277 | want_refresh = 1; |
1276 | want_refresh = 1; |
1278 | ZERO_SCROLLBACK (); |
1277 | ZERO_SCROLLBACK (); |
… | |
… | |
1332 | * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J |
1331 | * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J |
1333 | * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J |
1332 | * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J |
1334 | * XTERM_SEQ: Clear whole screen : ESC [ 2 J |
1333 | * XTERM_SEQ: Clear whole screen : ESC [ 2 J |
1335 | */ |
1334 | */ |
1336 | void |
1335 | void |
1337 | rxvt_term::scr_erase_screen (int mode) NOTHROW |
1336 | rxvt_term::scr_erase_screen (int mode) noexcept |
1338 | { |
1337 | { |
1339 | int num; |
1338 | int num; |
1340 | int32_t row; |
1339 | int32_t row; |
1341 | rend_t ren; |
1340 | rend_t ren; |
1342 | XGCValues gcvalue; |
1341 | XGCValues gcvalue; |
… | |
… | |
1412 | } |
1411 | } |
1413 | } |
1412 | } |
1414 | |
1413 | |
1415 | #if !ENABLE_MINIMAL |
1414 | #if !ENABLE_MINIMAL |
1416 | void |
1415 | void |
1417 | rxvt_term::scr_erase_savelines () NOTHROW |
1416 | rxvt_term::scr_erase_savelines () noexcept |
1418 | { |
1417 | { |
1419 | want_refresh = 1; |
1418 | want_refresh = 1; |
1420 | ZERO_SCROLLBACK (); |
1419 | ZERO_SCROLLBACK (); |
1421 | |
1420 | |
1422 | top_row = 0; |
1421 | top_row = 0; |
… | |
… | |
1427 | /* |
1426 | /* |
1428 | * Fill the screen with `E's |
1427 | * Fill the screen with `E's |
1429 | * XTERM_SEQ: Screen Alignment Test: ESC # 8 |
1428 | * XTERM_SEQ: Screen Alignment Test: ESC # 8 |
1430 | */ |
1429 | */ |
1431 | void ecb_cold |
1430 | void ecb_cold |
1432 | rxvt_term::scr_E () NOTHROW |
1431 | rxvt_term::scr_E () noexcept |
1433 | { |
1432 | { |
1434 | rend_t fs; |
1433 | rend_t fs; |
1435 | |
1434 | |
1436 | want_refresh = 1; |
1435 | want_refresh = 1; |
1437 | ZERO_SCROLLBACK (); |
1436 | ZERO_SCROLLBACK (); |
… | |
… | |
1462 | /* ------------------------------------------------------------------------- */ |
1461 | /* ------------------------------------------------------------------------- */ |
1463 | /* |
1462 | /* |
1464 | * Insert/Delete <count> lines |
1463 | * Insert/Delete <count> lines |
1465 | */ |
1464 | */ |
1466 | void |
1465 | void |
1467 | rxvt_term::scr_insdel_lines (int count, int insdel) NOTHROW |
1466 | rxvt_term::scr_insdel_lines (int count, int insdel) noexcept |
1468 | { |
1467 | { |
1469 | int end; |
1468 | int end; |
1470 | |
1469 | |
1471 | ZERO_SCROLLBACK (); |
1470 | ZERO_SCROLLBACK (); |
1472 | |
1471 | |
… | |
… | |
1492 | /* ------------------------------------------------------------------------- */ |
1491 | /* ------------------------------------------------------------------------- */ |
1493 | /* |
1492 | /* |
1494 | * Insert/Delete <count> characters from the current position |
1493 | * Insert/Delete <count> characters from the current position |
1495 | */ |
1494 | */ |
1496 | void |
1495 | void |
1497 | rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW |
1496 | rxvt_term::scr_insdel_chars (int count, int insdel) noexcept |
1498 | { |
1497 | { |
1499 | want_refresh = 1; |
1498 | want_refresh = 1; |
1500 | ZERO_SCROLLBACK (); |
1499 | ZERO_SCROLLBACK (); |
1501 | |
1500 | |
1502 | if (count <= 0) |
1501 | if (count <= 0) |
… | |
… | |
1601 | /* |
1600 | /* |
1602 | * Set the scrolling region |
1601 | * Set the scrolling region |
1603 | * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r |
1602 | * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r |
1604 | */ |
1603 | */ |
1605 | void ecb_cold |
1604 | void ecb_cold |
1606 | rxvt_term::scr_scroll_region (int top, int bot) NOTHROW |
1605 | rxvt_term::scr_scroll_region (int top, int bot) noexcept |
1607 | { |
1606 | { |
1608 | max_it (top, 0); |
1607 | max_it (top, 0); |
1609 | min_it (bot, nrow - 1); |
1608 | min_it (bot, nrow - 1); |
1610 | |
1609 | |
1611 | if (top > bot) |
1610 | if (top > bot) |
… | |
… | |
1621 | * Make the cursor visible/invisible |
1620 | * Make the cursor visible/invisible |
1622 | * XTERM_SEQ: Make cursor visible : ESC [ ? 25 h |
1621 | * XTERM_SEQ: Make cursor visible : ESC [ ? 25 h |
1623 | * XTERM_SEQ: Make cursor invisible: ESC [ ? 25 l |
1622 | * XTERM_SEQ: Make cursor invisible: ESC [ ? 25 l |
1624 | */ |
1623 | */ |
1625 | void ecb_cold |
1624 | void ecb_cold |
1626 | rxvt_term::scr_cursor_visible (int mode) NOTHROW |
1625 | rxvt_term::scr_cursor_visible (int mode) noexcept |
1627 | { |
1626 | { |
1628 | want_refresh = 1; |
1627 | want_refresh = 1; |
1629 | |
1628 | |
1630 | if (mode) |
1629 | if (mode) |
1631 | screen.flags |= Screen_VisibleCursor; |
1630 | screen.flags |= Screen_VisibleCursor; |
… | |
… | |
1638 | * Set/unset automatic wrapping |
1637 | * Set/unset automatic wrapping |
1639 | * XTERM_SEQ: Set Wraparound : ESC [ ? 7 h |
1638 | * XTERM_SEQ: Set Wraparound : ESC [ ? 7 h |
1640 | * XTERM_SEQ: Unset Wraparound: ESC [ ? 7 l |
1639 | * XTERM_SEQ: Unset Wraparound: ESC [ ? 7 l |
1641 | */ |
1640 | */ |
1642 | void ecb_cold |
1641 | void ecb_cold |
1643 | rxvt_term::scr_autowrap (int mode) NOTHROW |
1642 | rxvt_term::scr_autowrap (int mode) noexcept |
1644 | { |
1643 | { |
1645 | if (mode) |
1644 | if (mode) |
1646 | screen.flags |= Screen_Autowrap; |
1645 | screen.flags |= Screen_Autowrap; |
1647 | else |
1646 | else |
1648 | screen.flags &= ~(Screen_Autowrap | Screen_WrapNext); |
1647 | screen.flags &= ~(Screen_Autowrap | Screen_WrapNext); |
… | |
… | |
1657 | * and the cursor cannot be moved outside. |
1656 | * and the cursor cannot be moved outside. |
1658 | * XTERM_SEQ: Set Absolute: ESC [ ? 6 h |
1657 | * XTERM_SEQ: Set Absolute: ESC [ ? 6 h |
1659 | * XTERM_SEQ: Set Relative: ESC [ ? 6 l |
1658 | * XTERM_SEQ: Set Relative: ESC [ ? 6 l |
1660 | */ |
1659 | */ |
1661 | void ecb_cold |
1660 | void ecb_cold |
1662 | rxvt_term::scr_relative_origin (int mode) NOTHROW |
1661 | rxvt_term::scr_relative_origin (int mode) noexcept |
1663 | { |
1662 | { |
1664 | if (mode) |
1663 | if (mode) |
1665 | screen.flags |= Screen_Relative; |
1664 | screen.flags |= Screen_Relative; |
1666 | else |
1665 | else |
1667 | screen.flags &= ~Screen_Relative; |
1666 | screen.flags &= ~Screen_Relative; |
… | |
… | |
1674 | * Set insert/replace mode |
1673 | * Set insert/replace mode |
1675 | * XTERM_SEQ: Set Insert mode : ESC [ ? 4 h |
1674 | * XTERM_SEQ: Set Insert mode : ESC [ ? 4 h |
1676 | * XTERM_SEQ: Set Replace mode: ESC [ ? 4 l |
1675 | * XTERM_SEQ: Set Replace mode: ESC [ ? 4 l |
1677 | */ |
1676 | */ |
1678 | void ecb_cold |
1677 | void ecb_cold |
1679 | rxvt_term::scr_insert_mode (int mode) NOTHROW |
1678 | rxvt_term::scr_insert_mode (int mode) noexcept |
1680 | { |
1679 | { |
1681 | if (mode) |
1680 | if (mode) |
1682 | screen.flags |= Screen_Insert; |
1681 | screen.flags |= Screen_Insert; |
1683 | else |
1682 | else |
1684 | screen.flags &= ~Screen_Insert; |
1683 | screen.flags &= ~Screen_Insert; |
… | |
… | |
1690 | * XTERM_SEQ: Set tab at current column : ESC H |
1689 | * XTERM_SEQ: Set tab at current column : ESC H |
1691 | * XTERM_SEQ: Clear tab at current column: ESC [ 0 g |
1690 | * XTERM_SEQ: Clear tab at current column: ESC [ 0 g |
1692 | * XTERM_SEQ: Clear all tabs : ESC [ 3 g |
1691 | * XTERM_SEQ: Clear all tabs : ESC [ 3 g |
1693 | */ |
1692 | */ |
1694 | void ecb_cold |
1693 | void ecb_cold |
1695 | rxvt_term::scr_set_tab (int mode) NOTHROW |
1694 | rxvt_term::scr_set_tab (int mode) noexcept |
1696 | { |
1695 | { |
1697 | if (mode < 0) |
1696 | if (mode < 0) |
1698 | memset (tabs, 0, ncol); |
1697 | memset (tabs, 0, ncol); |
1699 | else if (screen.cur.col < ncol) |
1698 | else if (screen.cur.col < ncol) |
1700 | tabs [screen.cur.col] = !!mode; |
1699 | tabs [screen.cur.col] = !!mode; |
… | |
… | |
1705 | * Set reverse/normal video |
1704 | * Set reverse/normal video |
1706 | * XTERM_SEQ: Reverse video: ESC [ ? 5 h |
1705 | * XTERM_SEQ: Reverse video: ESC [ ? 5 h |
1707 | * XTERM_SEQ: Normal video : ESC [ ? 5 l |
1706 | * XTERM_SEQ: Normal video : ESC [ ? 5 l |
1708 | */ |
1707 | */ |
1709 | void |
1708 | void |
1710 | rxvt_term::scr_rvideo_mode (bool on) NOTHROW |
1709 | rxvt_term::scr_rvideo_mode (bool on) noexcept |
1711 | { |
1710 | { |
1712 | rvideo_mode = on; |
1711 | rvideo_mode = on; |
1713 | |
1712 | |
1714 | #ifndef NO_BELL |
1713 | #ifndef NO_BELL |
1715 | on ^= rvideo_bell; |
1714 | on ^= rvideo_bell; |
… | |
… | |
1717 | |
1716 | |
1718 | if (rvideo_state != on) |
1717 | if (rvideo_state != on) |
1719 | { |
1718 | { |
1720 | rvideo_state = on; |
1719 | rvideo_state = on; |
1721 | |
1720 | |
|
|
1721 | #if OFF_FOCUS_FADING |
|
|
1722 | if (rs[Rs_fade]) |
|
|
1723 | { |
|
|
1724 | ::swap (pix_colors_focused[Color_fg], pix_colors_focused[Color_bg]); |
|
|
1725 | ::swap (pix_colors_unfocused[Color_fg], pix_colors_unfocused[Color_bg]); |
|
|
1726 | } |
|
|
1727 | else |
|
|
1728 | #endif |
1722 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1729 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1723 | #ifdef HAVE_IMG |
1730 | #ifdef HAVE_IMG |
1724 | if (bg_img == 0) |
1731 | if (bg_img == 0) |
1725 | #endif |
1732 | #endif |
1726 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
1733 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
… | |
… | |
1739 | /* |
1746 | /* |
1740 | * Report current cursor position |
1747 | * Report current cursor position |
1741 | * XTERM_SEQ: Report position: ESC [ 6 n |
1748 | * XTERM_SEQ: Report position: ESC [ 6 n |
1742 | */ |
1749 | */ |
1743 | void ecb_cold |
1750 | void ecb_cold |
1744 | rxvt_term::scr_report_position () NOTHROW |
1751 | rxvt_term::scr_report_position () noexcept |
1745 | { |
1752 | { |
1746 | tt_printf ("\033[%d;%dR", screen.cur.row + 1, screen.cur.col + 1); |
1753 | tt_printf ("\033[%d;%dR", screen.cur.row + 1, screen.cur.col + 1); |
1747 | } |
1754 | } |
1748 | |
1755 | |
1749 | /* ------------------------------------------------------------------------- * |
1756 | /* ------------------------------------------------------------------------- * |
… | |
… | |
1752 | |
1759 | |
1753 | /* |
1760 | /* |
1754 | * Set font style |
1761 | * Set font style |
1755 | */ |
1762 | */ |
1756 | void ecb_cold |
1763 | void ecb_cold |
1757 | rxvt_term::set_font_style () NOTHROW |
1764 | rxvt_term::set_font_style () noexcept |
1758 | { |
1765 | { |
1759 | #if 0 |
1766 | #if 0 |
1760 | switch (charsets [screen.charset]) |
1767 | switch (charsets [screen.charset]) |
1761 | { |
1768 | { |
1762 | case '0': /* DEC Special Character & Line Drawing Set */ |
1769 | case '0': /* DEC Special Character & Line Drawing Set */ |
… | |
… | |
1784 | * XTERM_SEQ: Invoke G1 character set: CTRL-N |
1791 | * XTERM_SEQ: Invoke G1 character set: CTRL-N |
1785 | * XTERM_SEQ: Invoke G2 character set: ESC N |
1792 | * XTERM_SEQ: Invoke G2 character set: ESC N |
1786 | * XTERM_SEQ: Invoke G3 character set: ESC O |
1793 | * XTERM_SEQ: Invoke G3 character set: ESC O |
1787 | */ |
1794 | */ |
1788 | void ecb_cold |
1795 | void ecb_cold |
1789 | rxvt_term::scr_charset_choose (int set) NOTHROW |
1796 | rxvt_term::scr_charset_choose (int set) noexcept |
1790 | { |
1797 | { |
1791 | screen.charset = set; |
1798 | screen.charset = set; |
1792 | set_font_style (); |
1799 | set_font_style (); |
1793 | } |
1800 | } |
1794 | |
1801 | |
… | |
… | |
1800 | * XTERM_SEQ: Set G2 character set: ESC * <C> |
1807 | * XTERM_SEQ: Set G2 character set: ESC * <C> |
1801 | * XTERM_SEQ: Set G3 character set: ESC + <C> |
1808 | * XTERM_SEQ: Set G3 character set: ESC + <C> |
1802 | * See set_font_style for possible values for <C> |
1809 | * See set_font_style for possible values for <C> |
1803 | */ |
1810 | */ |
1804 | void |
1811 | void |
1805 | rxvt_term::scr_charset_set (int set, unsigned int ch) NOTHROW |
1812 | rxvt_term::scr_charset_set (int set, unsigned int ch) noexcept |
1806 | { |
1813 | { |
1807 | charsets[set] = (unsigned char)ch; |
1814 | charsets[set] = (unsigned char)ch; |
1808 | set_font_style (); |
1815 | set_font_style (); |
1809 | } |
1816 | } |
1810 | |
1817 | |
… | |
… | |
1815 | |
1822 | |
1816 | /* |
1823 | /* |
1817 | * refresh matching text. |
1824 | * refresh matching text. |
1818 | */ |
1825 | */ |
1819 | bool ecb_cold |
1826 | bool ecb_cold |
1820 | rxvt_term::scr_refresh_rend (rend_t mask, rend_t value) NOTHROW |
1827 | rxvt_term::scr_refresh_rend (rend_t mask, rend_t value) noexcept |
1821 | { |
1828 | { |
1822 | bool found = false; |
1829 | bool found = false; |
1823 | |
1830 | |
1824 | for (int i = 0; i < nrow; i++) |
1831 | for (int i = 0; i < nrow; i++) |
1825 | { |
1832 | { |
… | |
… | |
1844 | PART_END, |
1851 | PART_END, |
1845 | RC_COUNT |
1852 | RC_COUNT |
1846 | }; |
1853 | }; |
1847 | |
1854 | |
1848 | void ecb_hot |
1855 | void ecb_hot |
1849 | rxvt_term::scr_expose (int x, int y, int ewidth, int eheight, bool refresh) NOTHROW |
1856 | rxvt_term::scr_expose (int x, int y, int ewidth, int eheight, bool refresh) noexcept |
1850 | { |
1857 | { |
1851 | int i; |
1858 | int i; |
1852 | row_col_t rc[RC_COUNT]; |
1859 | row_col_t rc[RC_COUNT]; |
1853 | |
1860 | |
1854 | if (!drawn_buf) /* sanity check */ |
1861 | if (!drawn_buf) /* sanity check */ |
… | |
… | |
1888 | /* ------------------------------------------------------------------------- */ |
1895 | /* ------------------------------------------------------------------------- */ |
1889 | /* |
1896 | /* |
1890 | * Refresh the entire screen |
1897 | * Refresh the entire screen |
1891 | */ |
1898 | */ |
1892 | void |
1899 | void |
1893 | rxvt_term::scr_touch (bool refresh) NOTHROW |
1900 | rxvt_term::scr_touch (bool refresh) noexcept |
1894 | { |
1901 | { |
1895 | scr_expose (0, 0, vt_width, vt_height, refresh); |
1902 | scr_expose (0, 0, vt_width, vt_height, refresh); |
1896 | } |
1903 | } |
1897 | |
1904 | |
1898 | /* ------------------------------------------------------------------------- */ |
1905 | /* ------------------------------------------------------------------------- */ |
1899 | /* |
1906 | /* |
1900 | * Move the display so that the line represented by scrollbar value Y is at |
1907 | * Move the display so that the line represented by scrollbar value Y is at |
1901 | * the top of the screen |
1908 | * the top of the screen |
1902 | */ |
1909 | */ |
1903 | void |
1910 | void |
1904 | rxvt_term::scr_move_to (int y, int len) NOTHROW |
1911 | rxvt_term::scr_move_to (int y, int len) noexcept |
1905 | { |
1912 | { |
1906 | scr_changeview ((top_row - nrow) * (len - y) / len + (nrow - 1)); |
1913 | // lerp (y, 0, len, top_row, nrow - 1) |
|
|
1914 | scr_changeview (top_row + (nrow - 1 - top_row) * y / len); |
1907 | } |
1915 | } |
1908 | |
1916 | |
1909 | /* ------------------------------------------------------------------------- */ |
1917 | /* ------------------------------------------------------------------------- */ |
1910 | /* |
1918 | /* |
1911 | * Page the screen up/down nlines |
1919 | * Page the screen up/down nlines |
1912 | * direction should be UP or DN |
1920 | * direction should be UP or DN |
1913 | */ |
1921 | */ |
1914 | bool |
1922 | bool |
1915 | rxvt_term::scr_page (enum page_dirn direction, int nlines) NOTHROW |
1923 | rxvt_term::scr_page (int nlines) noexcept |
1916 | { |
1924 | { |
1917 | int new_view_start = |
|
|
1918 | direction == UP ? view_start - nlines |
|
|
1919 | : view_start + nlines; |
|
|
1920 | |
|
|
1921 | return scr_changeview (new_view_start); |
1925 | return scr_changeview (view_start - nlines); |
1922 | } |
1926 | } |
1923 | |
1927 | |
1924 | bool |
1928 | bool |
1925 | rxvt_term::scr_changeview (int new_view_start) NOTHROW |
1929 | rxvt_term::scr_changeview (int new_view_start) noexcept |
1926 | { |
1930 | { |
1927 | clamp_it (new_view_start, top_row, 0); |
1931 | clamp_it (new_view_start, top_row, 0); |
1928 | |
1932 | |
1929 | if (new_view_start == view_start) |
1933 | if (new_view_start == view_start) |
1930 | return false; |
1934 | return false; |
… | |
… | |
1948 | } |
1952 | } |
1949 | #endif |
1953 | #endif |
1950 | |
1954 | |
1951 | /* ------------------------------------------------------------------------- */ |
1955 | /* ------------------------------------------------------------------------- */ |
1952 | void |
1956 | void |
1953 | rxvt_term::scr_bell () NOTHROW |
1957 | rxvt_term::scr_bell () noexcept |
1954 | { |
1958 | { |
1955 | #ifndef NO_BELL |
1959 | #ifndef NO_BELL |
1956 | |
1960 | |
1957 | # ifndef NO_MAPALERT |
1961 | # ifndef NO_MAPALERT |
1958 | # ifdef MAPALERT_OPTION |
1962 | # ifdef MAPALERT_OPTION |
… | |
… | |
1980 | #endif |
1984 | #endif |
1981 | } |
1985 | } |
1982 | |
1986 | |
1983 | /* ------------------------------------------------------------------------- */ |
1987 | /* ------------------------------------------------------------------------- */ |
1984 | void ecb_cold |
1988 | void ecb_cold |
1985 | rxvt_term::scr_printscreen (int fullhist) NOTHROW |
1989 | rxvt_term::scr_printscreen (int fullhist) noexcept |
1986 | { |
1990 | { |
1987 | #ifdef PRINTPIPE |
1991 | #ifdef PRINTPIPE |
1988 | int nrows, row_start; |
1992 | int nrows, row_start; |
1989 | FILE *fd = popen_printer (); |
1993 | FILE *fd = popen_printer (); |
1990 | |
1994 | |
… | |
… | |
2039 | * Refresh the screen |
2043 | * Refresh the screen |
2040 | * drawn_text/drawn_rend contain the screen information before the update. |
2044 | * drawn_text/drawn_rend contain the screen information before the update. |
2041 | * screen.text/screen.rend contain what the screen will change to. |
2045 | * screen.text/screen.rend contain what the screen will change to. |
2042 | */ |
2046 | */ |
2043 | void ecb_hot |
2047 | void ecb_hot |
2044 | rxvt_term::scr_refresh () NOTHROW |
2048 | rxvt_term::scr_refresh () noexcept |
2045 | { |
2049 | { |
2046 | int16_t col, row, /* column/row we're processing */ |
2050 | int16_t col, row, /* column/row we're processing */ |
2047 | ocrow; /* old cursor row */ |
2051 | ocrow; /* old cursor row */ |
2048 | int i; /* tmp */ |
2052 | int i; /* tmp */ |
2049 | rend_t ccol1, /* Cursor colour */ |
2053 | rend_t ccol1, /* Cursor colour */ |
… | |
… | |
2083 | |
2087 | |
2084 | /* |
2088 | /* |
2085 | * C: set the cursor character (s) |
2089 | * C: set the cursor character (s) |
2086 | */ |
2090 | */ |
2087 | { |
2091 | { |
2088 | bool setoldcursor; |
|
|
2089 | |
|
|
2090 | #ifdef CURSOR_BLINK |
2092 | #ifdef CURSOR_BLINK |
2091 | if (hidden_cursor) |
2093 | if (hidden_cursor) |
2092 | showcursor = 0; |
2094 | showcursor = 0; |
2093 | #endif |
2095 | #endif |
2094 | |
2096 | |
… | |
… | |
2127 | ccol2 = bgcolor_of (rstyle); |
2129 | ccol2 = bgcolor_of (rstyle); |
2128 | #else |
2130 | #else |
2129 | ccol2 = Color_bg; |
2131 | ccol2 = Color_bg; |
2130 | #endif |
2132 | #endif |
2131 | |
2133 | |
2132 | if (focus) |
2134 | if (focus && cursor_type == 0) |
2133 | { |
2135 | { |
2134 | rend_t rend = cur_rend; |
2136 | rend_t rend = cur_rend; |
2135 | |
2137 | |
2136 | if (option (Opt_cursorUnderline)) |
|
|
2137 | rend ^= RS_Uline; |
|
|
2138 | else |
|
|
2139 | { |
|
|
2140 | rend ^= RS_RVid; |
2138 | rend ^= RS_RVid; |
2141 | rend = SET_FGCOLOR (rend, ccol1); |
2139 | rend = SET_FGCOLOR (rend, ccol1); |
2142 | rend = SET_BGCOLOR (rend, ccol2); |
2140 | rend = SET_BGCOLOR (rend, ccol2); |
2143 | } |
|
|
2144 | |
2141 | |
2145 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2142 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2146 | } |
2143 | } |
2147 | } |
2144 | } |
2148 | |
2145 | |
2149 | /* make sure no outline cursor is left around */ |
2146 | /* make sure no outline cursor is left around */ |
2150 | setoldcursor = 0; |
2147 | if (ocrow != -1 && ocrow < nrow && oldcursor.col < ncol) |
2151 | if (ocrow != -1) |
2148 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
|
|
2149 | |
|
|
2150 | // save the current cursor coordinates if the cursor is visible |
|
|
2151 | // and either the window is unfocused or the cursor style is |
|
|
2152 | // underline or vertical bar, so as to clear the outline cursor in |
|
|
2153 | // the next refresh if the cursor moves or becomes invisible |
|
|
2154 | if (showcursor && (!focus || cursor_type != 0) && screen.cur.row - view_start < nrow) |
2152 | { |
2155 | { |
2153 | if (screen.cur.row - view_start != ocrow |
2156 | oldcursor.row = screen.cur.row - view_start; |
2154 | || screen.cur.col != oldcursor.col) |
2157 | oldcursor.col = screen.cur.col; |
2155 | { |
|
|
2156 | if (ocrow < nrow |
|
|
2157 | && oldcursor.col < ncol) |
|
|
2158 | 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 | } |
|
|
2165 | } |
2158 | } |
2166 | else if (!focus) |
2159 | else |
2167 | setoldcursor = 1; |
|
|
2168 | |
|
|
2169 | if (setoldcursor) |
|
|
2170 | { |
|
|
2171 | if (screen.cur.row - view_start >= nrow) |
|
|
2172 | oldcursor.row = -1; |
2160 | oldcursor.row = -1; |
2173 | else |
|
|
2174 | { |
|
|
2175 | oldcursor.row = screen.cur.row - view_start; |
|
|
2176 | oldcursor.col = screen.cur.col; |
|
|
2177 | } |
|
|
2178 | } |
|
|
2179 | } |
2161 | } |
2180 | |
2162 | |
2181 | #ifndef NO_SLOW_LINK_SUPPORT |
2163 | #ifndef NO_SLOW_LINK_SUPPORT |
2182 | /* |
2164 | /* |
2183 | * D: CopyArea pass - very useful for slower links |
2165 | * D: CopyArea pass - very useful for slower links |
… | |
… | |
2264 | int ypixel = (int)Row2Pixel (row); |
2246 | int ypixel = (int)Row2Pixel (row); |
2265 | |
2247 | |
2266 | for (col = 0; col < ncol; col++) |
2248 | for (col = 0; col < ncol; col++) |
2267 | { |
2249 | { |
2268 | /* compare new text with old - if exactly the same then continue */ |
2250 | /* compare new text with old - if exactly the same then continue */ |
2269 | if (stp[col] == dtp[col] /* Must match characters to skip. */ |
2251 | if (stp[col] == dtp[col] && RS_SAME (srp[col], drp[col])) |
2270 | && (RS_SAME (srp[col], drp[col]) /* Either rendition the same or */ |
|
|
2271 | || (stp[col] == ' ' /* space w/ no background change */ |
|
|
2272 | && GET_BGATTR (srp[col]) == GET_BGATTR (drp[col])))) |
|
|
2273 | continue; |
2252 | continue; |
2274 | |
2253 | |
2275 | // redraw one or more characters |
2254 | // redraw one or more characters |
2276 | |
2255 | |
2277 | // seek to the beginning of wide characters |
2256 | // seek to the beginning of wide characters |
… | |
… | |
2473 | * G: cleanup cursor and display outline cursor if necessary |
2452 | * G: cleanup cursor and display outline cursor if necessary |
2474 | */ |
2453 | */ |
2475 | if (showcursor) |
2454 | if (showcursor) |
2476 | { |
2455 | { |
2477 | if (focus) |
2456 | if (focus) |
|
|
2457 | { |
|
|
2458 | if (cursor_type == 0) |
2478 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
2459 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
|
|
2460 | else if (oldcursor.row >= 0) |
|
|
2461 | { |
|
|
2462 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
|
|
2463 | if (cursor_type == 1) |
|
|
2464 | XFillRectangle (dpy, vt, gc, |
|
|
2465 | Col2Pixel (cur_col), |
|
|
2466 | Row2Pixel (oldcursor.row + 1) - 2, |
|
|
2467 | Width2Pixel (1), |
|
|
2468 | 2); |
|
|
2469 | else |
|
|
2470 | XFillRectangle (dpy, vt, gc, |
|
|
2471 | Col2Pixel (cur_col), |
|
|
2472 | Row2Pixel (oldcursor.row), |
|
|
2473 | 2, |
|
|
2474 | Height2Pixel (1)); |
|
|
2475 | } |
|
|
2476 | } |
2479 | else if (oldcursor.row >= 0) |
2477 | else if (oldcursor.row >= 0) |
2480 | { |
2478 | { |
2481 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2479 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2482 | |
2480 | |
2483 | XDrawRectangle (dpy, vt, gc, |
2481 | XDrawRectangle (dpy, vt, gc, |
… | |
… | |
2502 | num_scr = 0; |
2500 | num_scr = 0; |
2503 | num_scr_allow = 1; |
2501 | num_scr_allow = 1; |
2504 | } |
2502 | } |
2505 | |
2503 | |
2506 | void ecb_cold |
2504 | void ecb_cold |
2507 | rxvt_term::scr_remap_chars (line_t &l) NOTHROW |
2505 | rxvt_term::scr_remap_chars (line_t &l) noexcept |
2508 | { |
2506 | { |
2509 | if (!l.valid ()) |
2507 | if (!l.valid ()) |
2510 | return; |
2508 | return; |
2511 | |
2509 | |
2512 | l.touch (); // maybe a bit of an overkill, but it's not performance-relevant |
2510 | l.touch (); // maybe a bit of an overkill, but it's not performance-relevant |
… | |
… | |
2514 | for (int i = ncol; i--; ) |
2512 | for (int i = ncol; i--; ) |
2515 | l.r[i] = SET_FONT (l.r[i], FONTSET (l.r[i])->find_font (l.t[i])); |
2513 | l.r[i] = SET_FONT (l.r[i], FONTSET (l.r[i])->find_font (l.t[i])); |
2516 | } |
2514 | } |
2517 | |
2515 | |
2518 | void ecb_cold |
2516 | void ecb_cold |
2519 | rxvt_term::scr_remap_chars () NOTHROW |
2517 | rxvt_term::scr_remap_chars () noexcept |
2520 | { |
2518 | { |
2521 | for (int i = total_rows; i--; ) |
2519 | for (int i = total_rows; i--; ) |
2522 | scr_remap_chars (row_buf [i]); |
2520 | scr_remap_chars (row_buf [i]); |
2523 | |
2521 | |
2524 | for (int i = nrow; i--; ) |
2522 | for (int i = nrow; i--; ) |
… | |
… | |
2527 | scr_remap_chars (swap_buf [i]); |
2525 | scr_remap_chars (swap_buf [i]); |
2528 | } |
2526 | } |
2529 | } |
2527 | } |
2530 | |
2528 | |
2531 | void ecb_cold |
2529 | void ecb_cold |
2532 | rxvt_term::scr_recolour (bool refresh) NOTHROW |
2530 | rxvt_term::scr_recolor (bool refresh) noexcept |
2533 | { |
2531 | { |
2534 | bool transparent = false; |
2532 | bool transparent = false; |
2535 | |
2533 | |
2536 | #ifdef HAVE_IMG |
2534 | #ifdef HAVE_IMG |
2537 | if (bg_img != 0) |
2535 | if (bg_img != 0) |
… | |
… | |
2558 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2556 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2559 | } |
2557 | } |
2560 | |
2558 | |
2561 | XClearWindow (dpy, parent); |
2559 | XClearWindow (dpy, parent); |
2562 | |
2560 | |
2563 | if (scrollBar.win) |
2561 | if (scrollBar.state && scrollBar.win) |
2564 | { |
2562 | { |
2565 | if (transparent) |
2563 | if (transparent) |
2566 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2564 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2567 | else |
2565 | else |
2568 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); |
2566 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); |
… | |
… | |
2578 | want_refresh = 1; |
2576 | want_refresh = 1; |
2579 | } |
2577 | } |
2580 | |
2578 | |
2581 | /* ------------------------------------------------------------------------- */ |
2579 | /* ------------------------------------------------------------------------- */ |
2582 | void |
2580 | void |
2583 | rxvt_term::scr_clear (bool really) NOTHROW |
2581 | rxvt_term::scr_clear (bool really) noexcept |
2584 | { |
2582 | { |
2585 | if (!mapped) |
2583 | if (!mapped) |
2586 | return; |
2584 | return; |
2587 | |
2585 | |
2588 | num_scr_allow = 0; |
2586 | num_scr_allow = 0; |
… | |
… | |
2591 | if (really) |
2589 | if (really) |
2592 | XClearWindow (dpy, vt); |
2590 | XClearWindow (dpy, vt); |
2593 | } |
2591 | } |
2594 | |
2592 | |
2595 | void |
2593 | void |
2596 | rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle1, rend_t rstyle2) NOTHROW |
2594 | rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle1, rend_t rstyle2) noexcept |
2597 | { |
2595 | { |
2598 | int view_end = view_start + nrow; |
2596 | int view_end = view_start + nrow; |
2599 | int row, col; |
2597 | int row, col; |
2600 | |
2598 | |
2601 | for (row = max (beg_row, view_start); row <= min (end_row, view_end); row++) |
2599 | for (row = max (beg_row, view_start); row <= min (end_row, view_end); row++) |
… | |
… | |
2613 | srp[col] ^= rstyle2; |
2611 | srp[col] ^= rstyle2; |
2614 | } |
2612 | } |
2615 | } |
2613 | } |
2616 | |
2614 | |
2617 | void |
2615 | void |
2618 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle) NOTHROW |
2616 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle) noexcept |
2619 | { |
2617 | { |
2620 | int view_end = view_start + nrow; |
2618 | int view_end = view_start + nrow; |
2621 | int row, col; |
2619 | int row, col; |
2622 | |
2620 | |
2623 | if (beg_row >= view_start) |
2621 | if (beg_row >= view_start) |
… | |
… | |
2640 | srp[col] ^= rstyle; |
2638 | srp[col] ^= rstyle; |
2641 | } |
2639 | } |
2642 | |
2640 | |
2643 | /* ------------------------------------------------------------------------- */ |
2641 | /* ------------------------------------------------------------------------- */ |
2644 | void ecb_hot |
2642 | void ecb_hot |
2645 | rxvt_term::scr_reverse_selection () NOTHROW |
2643 | rxvt_term::scr_reverse_selection () noexcept |
2646 | { |
2644 | { |
2647 | if (selection.op |
2645 | if (selection.op |
2648 | && current_screen == selection.screen |
2646 | && current_screen == selection.screen |
2649 | && selection.end.row >= view_start) |
2647 | && selection.end.row >= view_start) |
2650 | { |
2648 | { |
… | |
… | |
2666 | * Dump the whole scrollback and screen to the passed filedescriptor. The |
2664 | * Dump the whole scrollback and screen to the passed filedescriptor. The |
2667 | * invoking routine must close the fd. |
2665 | * invoking routine must close the fd. |
2668 | */ |
2666 | */ |
2669 | #if 0 |
2667 | #if 0 |
2670 | void |
2668 | void |
2671 | rxvt_term::scr_dump (int fd) NOTHROW |
2669 | rxvt_term::scr_dump (int fd) noexcept |
2672 | { |
2670 | { |
2673 | // if this method is needed, it can be implemented by factoring the |
2671 | // if this method is needed, it can be implemented by factoring the |
2674 | // relevant code in scr_printscreen |
2672 | // relevant code in scr_printscreen |
2675 | } |
2673 | } |
2676 | #endif |
2674 | #endif |
2677 | |
2675 | |
2678 | /* ------------------------------------------------------------------------- * |
2676 | /* ------------------------------------------------------------------------- * |
2679 | * CHARACTER SELECTION * |
2677 | * CHARACTER SELECTION * |
2680 | * ------------------------------------------------------------------------- */ |
2678 | * ------------------------------------------------------------------------- */ |
2681 | void |
2679 | void |
2682 | rxvt_term::selection_check (int check_more) NOTHROW |
2680 | rxvt_term::selection_check (int check_more) noexcept |
2683 | { |
2681 | { |
2684 | if (!selection.op) |
2682 | if (!selection.op) |
2685 | return; |
2683 | return; |
2686 | |
2684 | |
2687 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
2685 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
… | |
… | |
2693 | && ROWCOL_IS_BEFORE (screen.cur, selection.end))) |
2691 | && ROWCOL_IS_BEFORE (screen.cur, selection.end))) |
2694 | CLEAR_ALL_SELECTION (); |
2692 | CLEAR_ALL_SELECTION (); |
2695 | } |
2693 | } |
2696 | |
2694 | |
2697 | void |
2695 | void |
2698 | rxvt_term::selection_changed () NOTHROW |
2696 | rxvt_term::selection_changed () noexcept |
2699 | { |
2697 | { |
2700 | line_t &r1 = ROW (selection.beg.row); |
2698 | line_t &r1 = ROW (selection.beg.row); |
2701 | while (selection.beg.col > 0 && r1.t [selection.beg.col] == NOCHAR) |
2699 | while (selection.beg.col < r1.l && r1.t [selection.beg.col] == NOCHAR) |
2702 | --selection.beg.col; |
2700 | ++selection.beg.col; |
2703 | |
2701 | |
2704 | line_t &r2 = ROW (selection.end.row); |
2702 | line_t &r2 = ROW (selection.end.row); |
2705 | while (selection.end.col < r2.l && r2.t [selection.end.col] == NOCHAR) |
2703 | while (selection.end.col < r2.l && r2.t [selection.end.col] == NOCHAR) |
2706 | ++selection.end.col; |
2704 | ++selection.end.col; |
2707 | |
2705 | |
… | |
… | |
2711 | /* ------------------------------------------------------------------------- */ |
2709 | /* ------------------------------------------------------------------------- */ |
2712 | /* |
2710 | /* |
2713 | * Paste a selection direct to the command fd |
2711 | * Paste a selection direct to the command fd |
2714 | */ |
2712 | */ |
2715 | void |
2713 | void |
2716 | rxvt_term::tt_paste (char *data, unsigned int len) NOTHROW |
2714 | rxvt_term::tt_paste (char *data, unsigned int len) noexcept |
2717 | { |
2715 | { |
2718 | /* convert normal newline chars into common keyboard Return key sequence */ |
2716 | /* convert normal newline chars into common keyboard Return key sequence */ |
2719 | for (unsigned int i = 0; i < len; i++) |
2717 | for (unsigned int i = 0; i < len; i++) |
2720 | if (data[i] == C0_LF) |
2718 | if (data[i] == C0_LF) |
2721 | data[i] = C0_CR; |
2719 | data[i] = C0_CR; |
2722 | |
2720 | |
2723 | if (priv_modes & PrivMode_BracketPaste) |
2721 | #if ENABLE_FRILLS |
|
|
2722 | if ((priv_modes & PrivMode_BracketPaste) && !option (Opt_disablePasteBrackets)) |
2724 | tt_printf ("\x1b[200~"); |
2723 | tt_printf ("\x1b[200~"); |
|
|
2724 | #endif |
2725 | |
2725 | |
2726 | tt_write (data, len); |
2726 | tt_write (data, len); |
2727 | |
2727 | |
2728 | if (priv_modes & PrivMode_BracketPaste) |
2728 | #if ENABLE_FRILLS |
|
|
2729 | if ((priv_modes & PrivMode_BracketPaste) && !option (Opt_disablePasteBrackets)) |
2729 | tt_printf ("\x1b[201~"); |
2730 | tt_printf ("\x1b[201~"); |
|
|
2731 | #endif |
2730 | } |
2732 | } |
2731 | |
2733 | |
2732 | void |
2734 | void |
2733 | rxvt_term::paste (char *data, unsigned int len) NOTHROW |
2735 | rxvt_term::paste (char *data, unsigned int len) noexcept |
2734 | { |
2736 | { |
2735 | if (HOOK_INVOKE ((this, HOOK_TT_PASTE, DT_STR_LEN, data, len, DT_END))) |
2737 | if (HOOK_INVOKE ((this, HOOK_TT_PASTE, DT_STR_LEN, data, len, DT_END))) |
2736 | return; |
2738 | return; |
2737 | |
2739 | |
2738 | tt_paste (data, len); |
2740 | tt_paste (data, len); |
… | |
… | |
2744 | * if the requested selection has no owner or is empty CUT_BUFFER0 is used |
2746 | * if the requested selection has no owner or is empty CUT_BUFFER0 is used |
2745 | * as fallback |
2747 | * as fallback |
2746 | * EXT: button 2 release |
2748 | * EXT: button 2 release |
2747 | */ |
2749 | */ |
2748 | void |
2750 | void |
2749 | rxvt_term::selection_request (Time tm, int selnum) NOTHROW |
2751 | rxvt_term::selection_request (Time tm, int selnum) noexcept |
2750 | { |
2752 | { |
2751 | if (!selection_req) |
2753 | if (!selection_req) |
2752 | { |
2754 | { |
2753 | selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this); |
2755 | selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this); |
2754 | selection_req->run (); |
2756 | selection_req->run (); |
… | |
… | |
2759 | /* |
2761 | /* |
2760 | * Clear all selected text |
2762 | * Clear all selected text |
2761 | * EXT: SelectionClear |
2763 | * EXT: SelectionClear |
2762 | */ |
2764 | */ |
2763 | void |
2765 | void |
2764 | rxvt_term::selection_clear (bool clipboard) NOTHROW |
2766 | rxvt_term::selection_clear (bool clipboard) noexcept |
2765 | { |
2767 | { |
2766 | if (!clipboard) |
2768 | if (!clipboard) |
2767 | { |
2769 | { |
2768 | want_refresh = 1; |
2770 | want_refresh = 1; |
2769 | free (selection.text); |
2771 | free (selection.text); |
… | |
… | |
2854 | if (*t == NOCHAR) |
2856 | if (*t == NOCHAR) |
2855 | t++; |
2857 | t++; |
2856 | #if ENABLE_COMBINING |
2858 | #if ENABLE_COMBINING |
2857 | else if (IS_COMPOSE (*t)) |
2859 | else if (IS_COMPOSE (*t)) |
2858 | { |
2860 | { |
2859 | int len = rxvt_composite.expand (*t, 0); |
2861 | int len = rxvt_composite.expand (*t); |
2860 | |
2862 | |
2861 | extra -= (len - 1); |
2863 | extra -= (len - 1); |
2862 | |
2864 | |
2863 | if (extra < 0) |
2865 | if (extra < 0) |
2864 | { |
2866 | { |
… | |
… | |
2911 | |
2913 | |
2912 | selection_grab (tm); |
2914 | selection_grab (tm); |
2913 | } |
2915 | } |
2914 | |
2916 | |
2915 | bool |
2917 | bool |
2916 | rxvt_term::selection_grab (Time tm, bool clipboard) NOTHROW |
2918 | rxvt_term::selection_grab (Time tm, bool clipboard) noexcept |
2917 | { |
2919 | { |
2918 | Atom sel; |
2920 | Atom sel; |
2919 | |
2921 | |
2920 | if (!clipboard) |
2922 | if (!clipboard) |
2921 | { |
2923 | { |
… | |
… | |
2955 | /* |
2957 | /* |
2956 | * Mark or select text based upon number of clicks: 1, 2, or 3 |
2958 | * Mark or select text based upon number of clicks: 1, 2, or 3 |
2957 | * EXT: button 1 press |
2959 | * EXT: button 1 press |
2958 | */ |
2960 | */ |
2959 | void ecb_cold |
2961 | void ecb_cold |
2960 | rxvt_term::selection_click (int clicks, int x, int y) NOTHROW |
2962 | rxvt_term::selection_click (int clicks, int x, int y) noexcept |
2961 | { |
2963 | { |
2962 | clicks = ((clicks - 1) % 3) + 1; |
2964 | clicks = ((clicks - 1) % 3) + 1; |
2963 | selection.clicks = clicks; /* save clicks so extend will work */ |
2965 | selection.clicks = clicks; /* save clicks so extend will work */ |
2964 | |
2966 | |
2965 | if (clicks == 2 && !selection.rect |
2967 | if (clicks == 2 && !selection.rect |
… | |
… | |
2984 | /* ------------------------------------------------------------------------- */ |
2986 | /* ------------------------------------------------------------------------- */ |
2985 | /* |
2987 | /* |
2986 | * Mark a selection at the specified col/row |
2988 | * Mark a selection at the specified col/row |
2987 | */ |
2989 | */ |
2988 | void ecb_cold |
2990 | void ecb_cold |
2989 | rxvt_term::selection_start_colrow (int col, int row) NOTHROW |
2991 | rxvt_term::selection_start_colrow (int col, int row) noexcept |
2990 | { |
2992 | { |
2991 | want_refresh = 1; |
2993 | want_refresh = 1; |
2992 | |
2994 | |
2993 | selection.mark.row = row + view_start; |
2995 | selection.mark.row = row + view_start; |
2994 | selection.mark.col = col; |
2996 | selection.mark.col = col; |
… | |
… | |
3021 | #define DELIMIT_TEXT(x) \ |
3023 | #define DELIMIT_TEXT(x) \ |
3022 | (unicode::is_space (x) ? 2 : (x) <= 0xff && !!strchr (rs[Rs_cutchars], (x))) |
3024 | (unicode::is_space (x) ? 2 : (x) <= 0xff && !!strchr (rs[Rs_cutchars], (x))) |
3023 | #define DELIMIT_REND(x) 1 |
3025 | #define DELIMIT_REND(x) 1 |
3024 | |
3026 | |
3025 | void ecb_cold |
3027 | void ecb_cold |
3026 | rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) NOTHROW |
3028 | rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) noexcept |
3027 | { |
3029 | { |
3028 | int col, row, dirnadd, tcol, trow, w1, w2; |
3030 | int col, row, dirnadd, tcol, trow, w1, w2; |
3029 | row_col_t bound; |
3031 | row_col_t bound; |
3030 | text_t *stp; |
3032 | text_t *stp; |
3031 | rend_t *srp; |
3033 | rend_t *srp; |
… | |
… | |
3105 | * flag == 0 ==> button 1 |
3107 | * flag == 0 ==> button 1 |
3106 | * flag == 1 ==> button 3 press |
3108 | * flag == 1 ==> button 3 press |
3107 | * flag == 2 ==> button 3 motion |
3109 | * flag == 2 ==> button 3 motion |
3108 | */ |
3110 | */ |
3109 | void ecb_cold |
3111 | void ecb_cold |
3110 | rxvt_term::selection_extend (int x, int y, int flag) NOTHROW |
3112 | rxvt_term::selection_extend (int x, int y, int flag) noexcept |
3111 | { |
3113 | { |
3112 | int col = clamp (Pixel2Col (x), 0, ncol); |
3114 | int col = clamp (Pixel2Col (x), 0, ncol); |
3113 | int row = clamp (Pixel2Row (y), 0, nrow - 1); |
3115 | int row = clamp (Pixel2Row (y), 0, nrow - 1); |
3114 | |
3116 | |
3115 | /* |
3117 | /* |
… | |
… | |
3141 | /* ------------------------------------------------------------------------- */ |
3143 | /* ------------------------------------------------------------------------- */ |
3142 | /* |
3144 | /* |
3143 | * Extend the selection to the specified col/row |
3145 | * Extend the selection to the specified col/row |
3144 | */ |
3146 | */ |
3145 | void ecb_cold |
3147 | void ecb_cold |
3146 | rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) NOTHROW |
3148 | rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) noexcept |
3147 | { |
3149 | { |
3148 | row_col_t pos; |
3150 | row_col_t pos; |
3149 | enum { |
3151 | enum { |
3150 | LEFT, RIGHT |
3152 | LEFT, RIGHT |
3151 | } closeto = RIGHT; |
3153 | } closeto = RIGHT; |
… | |
… | |
3342 | selection_changed (); |
3344 | selection_changed (); |
3343 | } |
3345 | } |
3344 | |
3346 | |
3345 | #if !ENABLE_MINIMAL |
3347 | #if !ENABLE_MINIMAL |
3346 | void ecb_cold |
3348 | void ecb_cold |
3347 | rxvt_term::selection_remove_trailing_spaces () NOTHROW |
3349 | rxvt_term::selection_remove_trailing_spaces () noexcept |
3348 | { |
3350 | { |
3349 | int32_t end_col, end_row; |
3351 | int32_t end_col, end_row; |
3350 | text_t *stp; |
3352 | text_t *stp; |
3351 | |
3353 | |
3352 | end_col = selection.end.col; |
3354 | end_col = selection.end.col; |
… | |
… | |
3390 | /* |
3392 | /* |
3391 | * Double click on button 3 when already selected |
3393 | * Double click on button 3 when already selected |
3392 | * EXT: button 3 double click |
3394 | * EXT: button 3 double click |
3393 | */ |
3395 | */ |
3394 | void ecb_cold |
3396 | void ecb_cold |
3395 | rxvt_term::selection_rotate (int x, int y) NOTHROW |
3397 | rxvt_term::selection_rotate (int x, int y) noexcept |
3396 | { |
3398 | { |
3397 | selection.clicks = selection.clicks % 3 + 1; |
3399 | selection.clicks = selection.clicks % 3 + 1; |
3398 | selection_extend_colrow (Pixel2Col (x), Pixel2Row (y), 1, 0, 1); |
3400 | selection_extend_colrow (Pixel2Col (x), Pixel2Row (y), 1, 0, 1); |
3399 | } |
3401 | } |
3400 | |
3402 | |
… | |
… | |
3402 | /* |
3404 | /* |
3403 | * Respond to a request for our current selection |
3405 | * Respond to a request for our current selection |
3404 | * EXT: SelectionRequest |
3406 | * EXT: SelectionRequest |
3405 | */ |
3407 | */ |
3406 | void ecb_cold |
3408 | void ecb_cold |
3407 | rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW |
3409 | rxvt_term::selection_send (const XSelectionRequestEvent &rq) noexcept |
3408 | { |
3410 | { |
3409 | Atom property = rq.property == None ? rq.target : rq.property; |
3411 | Atom property = rq.property == None ? rq.target : rq.property; |
3410 | XSelectionEvent ev; |
3412 | XSelectionEvent ev; |
3411 | |
3413 | |
3412 | ev.type = SelectionNotify; |
3414 | ev.type = SelectionNotify; |
… | |
… | |
3504 | cl = selection.clip_text; |
3506 | cl = selection.clip_text; |
3505 | selectlen = selection.clip_len; |
3507 | selectlen = selection.clip_len; |
3506 | } |
3508 | } |
3507 | else |
3509 | else |
3508 | { |
3510 | { |
3509 | cl = L""; |
3511 | cl = (wchar_t *)L""; |
3510 | selectlen = 0; |
3512 | selectlen = 0; |
3511 | } |
3513 | } |
3512 | |
3514 | |
3513 | #if !ENABLE_MINIMAL |
3515 | #if !ENABLE_MINIMAL |
3514 | // xlib is horribly broken with respect to UTF8_STRING, and nobody cares to fix it |
3516 | // xlib is horribly broken with respect to UTF8_STRING, and nobody cares to fix it |
… | |
… | |
3546 | } |
3548 | } |
3547 | |
3549 | |
3548 | /* ------------------------------------------------------------------------- */ |
3550 | /* ------------------------------------------------------------------------- */ |
3549 | #if USE_XIM |
3551 | #if USE_XIM |
3550 | void ecb_cold |
3552 | void ecb_cold |
3551 | rxvt_term::im_set_position (XPoint &pos) NOTHROW |
3553 | rxvt_term::im_set_position (XPoint &pos) noexcept |
3552 | { |
3554 | { |
3553 | XWindowAttributes xwa; |
3555 | XWindowAttributes xwa; |
3554 | |
3556 | |
3555 | XGetWindowAttributes (dpy, vt, &xwa); |
3557 | XGetWindowAttributes (dpy, vt, &xwa); |
3556 | |
3558 | |
… | |
… | |
3559 | } |
3561 | } |
3560 | #endif |
3562 | #endif |
3561 | |
3563 | |
3562 | #if ENABLE_OVERLAY |
3564 | #if ENABLE_OVERLAY |
3563 | void |
3565 | void |
3564 | rxvt_term::scr_overlay_new (int x, int y, int w, int h) NOTHROW |
3566 | rxvt_term::scr_overlay_new (int x, int y, int w, int h) noexcept |
3565 | { |
3567 | { |
3566 | if (nrow < 1 || ncol < 1) |
3568 | if (nrow < 1 || ncol < 1) |
3567 | return; |
3569 | return; |
3568 | |
3570 | |
3569 | want_refresh = 1; |
3571 | want_refresh = 1; |
… | |
… | |
3614 | *rp = r; |
3616 | *rp = r; |
3615 | } |
3617 | } |
3616 | } |
3618 | } |
3617 | |
3619 | |
3618 | void |
3620 | void |
3619 | rxvt_term::scr_overlay_off () NOTHROW |
3621 | rxvt_term::scr_overlay_off () noexcept |
3620 | { |
3622 | { |
3621 | if (!ov.text) |
3623 | if (!ov.text) |
3622 | return; |
3624 | return; |
3623 | |
3625 | |
3624 | want_refresh = 1; |
3626 | want_refresh = 1; |
… | |
… | |
3632 | delete [] ov.text; ov.text = 0; |
3634 | delete [] ov.text; ov.text = 0; |
3633 | delete [] ov.rend; ov.rend = 0; |
3635 | delete [] ov.rend; ov.rend = 0; |
3634 | } |
3636 | } |
3635 | |
3637 | |
3636 | void |
3638 | void |
3637 | rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW |
3639 | rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) noexcept |
3638 | { |
3640 | { |
3639 | if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2) |
3641 | if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2) |
3640 | return; |
3642 | return; |
3641 | |
3643 | |
3642 | x++, y++; |
3644 | x++, y++; |
… | |
… | |
3644 | ov.text[y][x] = text; |
3646 | ov.text[y][x] = text; |
3645 | ov.rend[y][x] = rend; |
3647 | ov.rend[y][x] = rend; |
3646 | } |
3648 | } |
3647 | |
3649 | |
3648 | void |
3650 | void |
3649 | rxvt_term::scr_overlay_set (int x, int y, const char *s) NOTHROW |
3651 | rxvt_term::scr_overlay_set (int x, int y, const char *s) noexcept |
3650 | { |
3652 | { |
3651 | while (*s) |
3653 | while (*s) |
3652 | scr_overlay_set (x++, y, *s++); |
3654 | scr_overlay_set (x++, y, *s++); |
3653 | } |
3655 | } |
3654 | |
3656 | |
3655 | void |
3657 | void |
3656 | rxvt_term::scr_overlay_set (int x, int y, const wchar_t *s) NOTHROW |
3658 | rxvt_term::scr_overlay_set (int x, int y, const wchar_t *s) noexcept |
3657 | { |
3659 | { |
3658 | while (*s) |
3660 | while (*s) |
3659 | { |
3661 | { |
3660 | text_t t = *s++; |
3662 | text_t t = *s++; |
3661 | int width = WCWIDTH (t); |
3663 | int width = WCWIDTH (t); |
… | |
… | |
3667 | } |
3669 | } |
3668 | } |
3670 | } |
3669 | } |
3671 | } |
3670 | |
3672 | |
3671 | void |
3673 | void |
3672 | rxvt_term::scr_swap_overlay () NOTHROW |
3674 | rxvt_term::scr_swap_overlay () noexcept |
3673 | { |
3675 | { |
3674 | if (!ov.text) |
3676 | if (!ov.text) |
3675 | return; |
3677 | return; |
3676 | |
3678 | |
3677 | // hide cursor if it is within the overlay area |
3679 | // hide cursor if it is within the overlay area |