… | |
… | |
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 { |
… | |
… | |
150 | l.r[col] = rend; |
151 | l.r[col] = rend; |
151 | col++; |
152 | col++; |
152 | } while (col < ncol && l.t[col] == NOCHAR); |
153 | } while (col < ncol && l.t[col] == NOCHAR); |
153 | } |
154 | } |
154 | |
155 | |
|
|
156 | // set the rendition of a single wide character beginning at the given column |
|
|
157 | void |
|
|
158 | rxvt_term::scr_set_char_rend (line_t &l, int col, rend_t rend) |
|
|
159 | { |
|
|
160 | do { |
|
|
161 | l.r[col] = rend; |
|
|
162 | col++; |
|
|
163 | } while (col < ncol && l.t[col] == NOCHAR); |
|
|
164 | } |
|
|
165 | |
155 | /* ------------------------------------------------------------------------- * |
166 | /* ------------------------------------------------------------------------- * |
156 | * SCREEN INITIALISATION * |
167 | * SCREEN INITIALISATION * |
157 | * ------------------------------------------------------------------------- */ |
168 | * ------------------------------------------------------------------------- */ |
158 | |
169 | |
159 | void |
170 | void |
160 | rxvt_term::scr_alloc () NOTHROW |
171 | rxvt_term::scr_alloc () noexcept |
161 | { |
172 | { |
162 | int tsize = sizeof (text_t) * ncol; |
173 | int tsize = sizeof (text_t) * ncol; |
163 | int rsize = sizeof (rend_t) * ncol; |
174 | int rsize = sizeof (rend_t) * ncol; |
164 | |
175 | |
165 | // we assume that rend_t size is a sufficient alignment |
176 | // we assume that rend_t size is a sufficient alignment |
… | |
… | |
188 | drawn_buf = (line_t *)chunk; |
199 | drawn_buf = (line_t *)chunk; |
189 | swap_buf = drawn_buf + nrow; |
200 | swap_buf = drawn_buf + nrow; |
190 | row_buf = swap_buf + nrow; |
201 | row_buf = swap_buf + nrow; |
191 | } |
202 | } |
192 | |
203 | |
|
|
204 | void |
|
|
205 | rxvt_term::copy_line (line_t &dst, line_t &src) |
|
|
206 | { |
|
|
207 | scr_blank_screen_mem (dst, DEFAULT_RSTYLE); |
|
|
208 | dst.l = min (src.l, ncol); |
|
|
209 | memcpy (dst.t, src.t, sizeof (text_t) * dst.l); |
|
|
210 | memcpy (dst.r, src.r, sizeof (rend_t) * dst.l); |
|
|
211 | dst.f = src.f; |
|
|
212 | } |
|
|
213 | |
193 | void ecb_cold |
214 | void ecb_cold |
194 | rxvt_term::scr_reset () |
215 | rxvt_term::scr_reset () |
195 | { |
216 | { |
196 | #if ENABLE_OVERLAY |
217 | #if ENABLE_OVERLAY |
197 | scr_overlay_off (); |
218 | scr_overlay_off (); |
… | |
… | |
230 | size_t prev_chunk_size = chunk_size; |
251 | size_t prev_chunk_size = chunk_size; |
231 | line_t *prev_drawn_buf = drawn_buf; |
252 | line_t *prev_drawn_buf = drawn_buf; |
232 | line_t *prev_swap_buf = swap_buf; |
253 | line_t *prev_swap_buf = swap_buf; |
233 | line_t *prev_row_buf = row_buf; |
254 | line_t *prev_row_buf = row_buf; |
234 | |
255 | |
235 | int common_col = min (prev_ncol, ncol); |
|
|
236 | |
|
|
237 | scr_alloc (); |
256 | scr_alloc (); |
238 | |
257 | |
239 | if (!prev_row_buf) |
258 | if (!prev_row_buf) |
240 | { |
259 | { |
241 | /* |
|
|
242 | * first time called (or after scr_release) so just malloc everything: don't rely on realloc |
|
|
243 | */ |
|
|
244 | top_row = 0; |
260 | top_row = 0; |
245 | term_start = 0; |
261 | term_start = 0; |
246 | |
262 | |
247 | memset (charsets, 'B', sizeof (charsets)); |
263 | memset (charsets, 'B', sizeof (charsets)); |
248 | rstyle = DEFAULT_RSTYLE; |
264 | rstyle = DEFAULT_RSTYLE; |
… | |
… | |
273 | { |
289 | { |
274 | /* |
290 | /* |
275 | * add or delete rows as appropriate |
291 | * add or delete rows as appropriate |
276 | */ |
292 | */ |
277 | |
293 | |
|
|
294 | int common_col = min (prev_ncol, ncol); |
|
|
295 | |
278 | for (int row = min (nrow, prev_nrow); row--; ) |
296 | for (int row = min (nrow, prev_nrow); row--; ) |
279 | { |
297 | { |
280 | scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); |
298 | scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); |
281 | scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE); |
|
|
282 | |
|
|
283 | memcpy (drawn_buf [row].t, prev_drawn_buf [row].t, sizeof (text_t) * common_col); |
299 | memcpy (drawn_buf [row].t, prev_drawn_buf [row].t, sizeof (text_t) * common_col); |
284 | memcpy (drawn_buf [row].r, prev_drawn_buf [row].r, sizeof (rend_t) * common_col); |
300 | memcpy (drawn_buf [row].r, prev_drawn_buf [row].r, sizeof (rend_t) * common_col); |
285 | memcpy (swap_buf [row].t, prev_swap_buf [row].t, sizeof (text_t) * common_col); |
301 | |
286 | memcpy (swap_buf [row].r, prev_swap_buf [row].r, sizeof (rend_t) * common_col); |
302 | copy_line (swap_buf [row], prev_swap_buf [row]); |
287 | } |
303 | } |
288 | |
304 | |
289 | 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 |
290 | int pend = MOD (term_start + top_row , prev_total_rows); |
306 | int pend = MOD (term_start + top_row , prev_total_rows); |
291 | int q = total_rows; // rewrapped row |
307 | int q = total_rows; // rewrapped row |
292 | |
308 | |
293 | if (top_row) |
309 | if ((rewrap_always || top_row) && !rewrap_never) |
294 | { |
310 | { |
295 | // 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 |
296 | // to come up with a lean and mean algorithm. |
312 | // to come up with a lean and mean algorithm. |
297 | // TODO: maybe optimise when width didn't change |
313 | // TODO: maybe optimise when width didn't change |
298 | |
314 | |
… | |
… | |
386 | for (int row = min (nrow, prev_nrow); row--; ) |
402 | for (int row = min (nrow, prev_nrow); row--; ) |
387 | { |
403 | { |
388 | line_t &src = prev_row_buf [MOD (term_start + row, prev_total_rows)]; |
404 | line_t &src = prev_row_buf [MOD (term_start + row, prev_total_rows)]; |
389 | line_t &dst = row_buf [row]; |
405 | line_t &dst = row_buf [row]; |
390 | |
406 | |
391 | scr_blank_screen_mem (dst, DEFAULT_RSTYLE); |
407 | copy_line (dst, src); |
392 | |
|
|
393 | memcpy (dst.t, src.t, sizeof (text_t) * common_col); |
|
|
394 | memcpy (dst.r, src.r, sizeof (rend_t) * common_col); |
|
|
395 | } |
408 | } |
396 | |
409 | |
397 | for (int row = prev_nrow; row < nrow; row++) |
410 | for (int row = prev_nrow; row < nrow; row++) |
398 | scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); |
411 | scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); |
399 | |
412 | |
… | |
… | |
409 | if (!ROW (row).valid ()) scr_blank_screen_mem (ROW (row), DEFAULT_RSTYLE); |
422 | if (!ROW (row).valid ()) scr_blank_screen_mem (ROW (row), DEFAULT_RSTYLE); |
410 | if (!swap_buf [row].valid ()) scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE); |
423 | if (!swap_buf [row].valid ()) scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE); |
411 | if (!drawn_buf [row].valid ()) scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); |
424 | if (!drawn_buf [row].valid ()) scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); |
412 | } |
425 | } |
413 | |
426 | |
414 | printf ("pc %p\n", prev_chunk);//D |
|
|
415 | chunk_free (prev_chunk, prev_chunk_size); |
427 | chunk_free (prev_chunk, prev_chunk_size); |
416 | |
428 | |
417 | free (tabs); |
429 | free (tabs); |
418 | tabs = (char *)rxvt_malloc (ncol); |
430 | tabs = (char *)rxvt_malloc (ncol); |
419 | |
431 | |
… | |
… | |
429 | |
441 | |
430 | HOOK_INVOKE ((this, HOOK_RESET, DT_END)); |
442 | HOOK_INVOKE ((this, HOOK_RESET, DT_END)); |
431 | } |
443 | } |
432 | |
444 | |
433 | void ecb_cold |
445 | void ecb_cold |
434 | rxvt_term::scr_release () NOTHROW |
446 | rxvt_term::scr_release () noexcept |
435 | { |
447 | { |
436 | chunk_free (chunk, chunk_size); |
448 | chunk_free (chunk, chunk_size); |
437 | chunk = 0; |
449 | chunk = 0; |
438 | row_buf = 0; |
450 | row_buf = 0; |
439 | |
451 | |
… | |
… | |
458 | scr_clear (true); |
470 | scr_clear (true); |
459 | scr_refresh (); |
471 | scr_refresh (); |
460 | } |
472 | } |
461 | |
473 | |
462 | void ecb_cold |
474 | void ecb_cold |
463 | rxvt_term::scr_soft_reset () NOTHROW |
475 | rxvt_term::scr_soft_reset () noexcept |
464 | { |
476 | { |
465 | /* only affects modes, nothing drastic such as clearing the screen */ |
477 | /* only affects modes, nothing drastic such as clearing the screen */ |
466 | #if ENABLE_OVERLAY |
478 | #if ENABLE_OVERLAY |
467 | scr_overlay_off (); |
479 | scr_overlay_off (); |
468 | #endif |
480 | #endif |
… | |
… | |
482 | * Save and Restore cursor |
494 | * Save and Restore cursor |
483 | * XTERM_SEQ: Save cursor : ESC 7 |
495 | * XTERM_SEQ: Save cursor : ESC 7 |
484 | * XTERM_SEQ: Restore cursor: ESC 8 |
496 | * XTERM_SEQ: Restore cursor: ESC 8 |
485 | */ |
497 | */ |
486 | void |
498 | void |
487 | rxvt_term::scr_cursor (cursor_mode mode) NOTHROW |
499 | rxvt_term::scr_cursor (cursor_mode mode) noexcept |
488 | { |
500 | { |
489 | screen_t *s; |
501 | screen_t *s; |
490 | |
502 | |
491 | #if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) |
503 | #if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) |
492 | if (current_screen == SECONDARY) |
504 | if (current_screen == SECONDARY) |
… | |
… | |
523 | assert (s->cur.row >= 0); |
535 | assert (s->cur.row >= 0); |
524 | assert (s->cur.col >= 0); |
536 | assert (s->cur.col >= 0); |
525 | } |
537 | } |
526 | |
538 | |
527 | void |
539 | void |
528 | rxvt_term::scr_swap_screen () NOTHROW |
540 | rxvt_term::scr_swap_screen () noexcept |
529 | { |
541 | { |
530 | if (!option (Opt_secondaryScreen)) |
542 | if (!option (Opt_secondaryScreen)) |
531 | return; |
543 | return; |
532 | |
544 | |
533 | for (int i = prev_nrow; i--; ) |
545 | for (int i = prev_nrow; i--; ) |
… | |
… | |
581 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
593 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
582 | } |
594 | } |
583 | |
595 | |
584 | // clear WrapNext indicator, solidifying position on next line |
596 | // clear WrapNext indicator, solidifying position on next line |
585 | void |
597 | void |
586 | rxvt_term::scr_do_wrap () NOTHROW |
598 | rxvt_term::scr_do_wrap () noexcept |
587 | { |
599 | { |
588 | if (!(screen.flags & Screen_WrapNext)) |
600 | if (!(screen.flags & Screen_WrapNext)) |
589 | return; |
601 | return; |
590 | |
602 | |
591 | screen.flags &= ~Screen_WrapNext; |
603 | screen.flags &= ~Screen_WrapNext; |
… | |
… | |
601 | /* ------------------------------------------------------------------------- */ |
613 | /* ------------------------------------------------------------------------- */ |
602 | /* |
614 | /* |
603 | * Change the colour for following text |
615 | * Change the colour for following text |
604 | */ |
616 | */ |
605 | void |
617 | void |
606 | rxvt_term::scr_color (unsigned int color, int fgbg) NOTHROW |
618 | rxvt_term::scr_color (unsigned int color, int fgbg) noexcept |
607 | { |
619 | { |
608 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
620 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR24)) |
609 | color = fgbg; |
621 | color = fgbg; |
610 | |
622 | |
611 | if (fgbg == Color_fg) |
623 | if (fgbg == Color_fg) |
612 | rstyle = SET_FGCOLOR (rstyle, color); |
624 | rstyle = SET_FGCOLOR (rstyle, color); |
613 | else |
625 | else |
… | |
… | |
617 | /* ------------------------------------------------------------------------- */ |
629 | /* ------------------------------------------------------------------------- */ |
618 | /* |
630 | /* |
619 | * Change the rendition style for following text |
631 | * Change the rendition style for following text |
620 | */ |
632 | */ |
621 | void |
633 | void |
622 | rxvt_term::scr_rendition (int set, int style) NOTHROW |
634 | rxvt_term::scr_rendition (int set, int style) noexcept |
623 | { |
635 | { |
624 | if (set) |
636 | if (set) |
625 | rstyle |= style; |
637 | rstyle |= style; |
626 | else if (style == ~RS_None) |
638 | else if (style == ~RS_None) |
627 | rstyle = DEFAULT_RSTYLE; |
639 | rstyle = DEFAULT_RSTYLE; |
… | |
… | |
634 | * Scroll text between <row1> and <row2> inclusive, by <count> lines |
646 | * Scroll text between <row1> and <row2> inclusive, by <count> lines |
635 | * count positive ==> scroll up |
647 | * count positive ==> scroll up |
636 | * count negative ==> scroll down |
648 | * count negative ==> scroll down |
637 | */ |
649 | */ |
638 | int ecb_hot |
650 | int ecb_hot |
639 | 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 |
640 | { |
652 | { |
641 | if (count == 0 || (row1 > row2)) |
653 | if (count == 0 || (row1 > row2)) |
642 | return 0; |
654 | return 0; |
643 | |
655 | |
644 | want_refresh = 1; |
656 | want_refresh = 1; |
… | |
… | |
704 | |
716 | |
705 | // finally move the view window, if desired |
717 | // finally move the view window, if desired |
706 | if (option (Opt_scrollWithBuffer) |
718 | if (option (Opt_scrollWithBuffer) |
707 | && view_start != 0 |
719 | && view_start != 0 |
708 | && view_start != -saveLines) |
720 | && view_start != -saveLines) |
709 | scr_page (UP, count); |
721 | scr_page (count); |
710 | |
722 | |
711 | if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) |
723 | if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) |
712 | 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)); |
713 | } |
725 | } |
714 | else |
726 | else |
… | |
… | |
778 | /* ------------------------------------------------------------------------- */ |
790 | /* ------------------------------------------------------------------------- */ |
779 | /* |
791 | /* |
780 | * Add text given in <str> of length <len> to screen struct |
792 | * Add text given in <str> of length <len> to screen struct |
781 | */ |
793 | */ |
782 | void ecb_hot |
794 | void ecb_hot |
783 | 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 |
784 | { |
796 | { |
785 | if (len <= 0) /* sanity */ |
797 | if (len <= 0) /* sanity */ |
786 | return; |
798 | return; |
787 | |
799 | |
788 | bool checksel; |
800 | bool checksel; |
… | |
… | |
1000 | } |
1012 | } |
1001 | else if (screen.cur.row > 0 |
1013 | else if (screen.cur.row > 0 |
1002 | && ROW(screen.cur.row - 1).is_longer ()) |
1014 | && ROW(screen.cur.row - 1).is_longer ()) |
1003 | { |
1015 | { |
1004 | linep = &ROW(screen.cur.row - 1); |
1016 | linep = &ROW(screen.cur.row - 1); |
1005 | tp = line->t + ncol - 1; |
1017 | tp = linep->t + ncol - 1; |
1006 | rp = line->r + ncol - 1; |
1018 | rp = linep->r + ncol - 1; |
1007 | } |
1019 | } |
1008 | else |
1020 | else |
1009 | continue; |
1021 | continue; |
1010 | |
1022 | |
1011 | linep->touch (); |
1023 | linep->touch (); |
… | |
… | |
1034 | /* |
1046 | /* |
1035 | * 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 |
1036 | * XTERM_SEQ: CTRL-H |
1048 | * XTERM_SEQ: CTRL-H |
1037 | */ |
1049 | */ |
1038 | void |
1050 | void |
1039 | rxvt_term::scr_backspace () NOTHROW |
1051 | rxvt_term::scr_backspace () noexcept |
1040 | { |
1052 | { |
1041 | if (screen.cur.col == 0) |
1053 | if (screen.cur.col == 0) |
1042 | { |
1054 | { |
1043 | if (screen.cur.row > 0) |
1055 | if (screen.cur.row > 0) |
1044 | { |
1056 | { |
… | |
… | |
1061 | * Process Horizontal Tab |
1073 | * Process Horizontal Tab |
1062 | * count: +ve = forward; -ve = backwards |
1074 | * count: +ve = forward; -ve = backwards |
1063 | * XTERM_SEQ: CTRL-I |
1075 | * XTERM_SEQ: CTRL-I |
1064 | */ |
1076 | */ |
1065 | void |
1077 | void |
1066 | rxvt_term::scr_tab (int count, bool ht) NOTHROW |
1078 | rxvt_term::scr_tab (int count, bool ht) noexcept |
1067 | { |
1079 | { |
1068 | int i, x; |
1080 | int i, x; |
1069 | |
1081 | |
1070 | want_refresh = 1; |
1082 | want_refresh = 1; |
1071 | i = x = screen.cur.col; |
1083 | i = x = screen.cur.col; |
… | |
… | |
1138 | * 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 |
1139 | * in that row right. Clear left column. |
1151 | * in that row right. Clear left column. |
1140 | */ |
1152 | */ |
1141 | #if !ENABLE_MINIMAL |
1153 | #if !ENABLE_MINIMAL |
1142 | void ecb_cold |
1154 | void ecb_cold |
1143 | rxvt_term::scr_backindex () NOTHROW |
1155 | rxvt_term::scr_backindex () noexcept |
1144 | { |
1156 | { |
1145 | if (screen.cur.col > 0) |
1157 | if (screen.cur.col > 0) |
1146 | scr_gotorc (0, -1, R_RELATIVE | C_RELATIVE); |
1158 | scr_gotorc (0, -1, R_RELATIVE | C_RELATIVE); |
1147 | else |
1159 | else |
1148 | scr_insdel_chars (1, INSERT); |
1160 | scr_insdel_chars (1, INSERT); |
… | |
… | |
1155 | * 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 |
1156 | * in that row left. Clear right column. |
1168 | * in that row left. Clear right column. |
1157 | */ |
1169 | */ |
1158 | #if !ENABLE_MINIMAL |
1170 | #if !ENABLE_MINIMAL |
1159 | void ecb_cold |
1171 | void ecb_cold |
1160 | rxvt_term::scr_forwardindex () NOTHROW |
1172 | rxvt_term::scr_forwardindex () noexcept |
1161 | { |
1173 | { |
1162 | if (screen.cur.col < ncol - 1) |
1174 | if (screen.cur.col < ncol - 1) |
1163 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1175 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1164 | else |
1176 | else |
1165 | { |
1177 | { |
… | |
… | |
1178 | /* ------------------------------------------------------------------------- */ |
1190 | /* ------------------------------------------------------------------------- */ |
1179 | /* |
1191 | /* |
1180 | * Goto Row/Column |
1192 | * Goto Row/Column |
1181 | */ |
1193 | */ |
1182 | void |
1194 | void |
1183 | rxvt_term::scr_gotorc (int row, int col, int relative) NOTHROW |
1195 | rxvt_term::scr_gotorc (int row, int col, int relative) noexcept |
1184 | { |
1196 | { |
1185 | want_refresh = 1; |
1197 | want_refresh = 1; |
1186 | ZERO_SCROLLBACK (); |
1198 | ZERO_SCROLLBACK (); |
1187 | |
1199 | |
1188 | screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; |
1200 | screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; |
… | |
… | |
1227 | /* ------------------------------------------------------------------------- */ |
1239 | /* ------------------------------------------------------------------------- */ |
1228 | /* |
1240 | /* |
1229 | * direction should be UP or DN |
1241 | * direction should be UP or DN |
1230 | */ |
1242 | */ |
1231 | void |
1243 | void |
1232 | rxvt_term::scr_index (enum page_dirn direction) NOTHROW |
1244 | rxvt_term::scr_index (enum page_dirn direction) noexcept |
1233 | { |
1245 | { |
1234 | int dirn; |
|
|
1235 | |
|
|
1236 | want_refresh = 1; |
1246 | want_refresh = 1; |
1237 | ZERO_SCROLLBACK (); |
1247 | ZERO_SCROLLBACK (); |
1238 | |
1248 | |
1239 | dirn = ((direction == UP) ? 1 : -1); |
|
|
1240 | |
|
|
1241 | screen.flags &= ~Screen_WrapNext; |
1249 | screen.flags &= ~Screen_WrapNext; |
1242 | |
1250 | |
1243 | if ((screen.cur.row == screen.bscroll && direction == UP) |
1251 | if ((screen.cur.row == screen.bscroll && direction == UP) |
1244 | || (screen.cur.row == screen.tscroll && direction == DN)) |
1252 | || (screen.cur.row == screen.tscroll && direction == DN)) |
1245 | scr_scroll_text (screen.tscroll, screen.bscroll, dirn); |
1253 | scr_scroll_text (screen.tscroll, screen.bscroll, direction); |
1246 | else |
1254 | else |
1247 | screen.cur.row += dirn; |
1255 | screen.cur.row += direction; |
1248 | |
1256 | |
1249 | clamp_it (screen.cur.row, 0, nrow - 1); |
1257 | clamp_it (screen.cur.row, 0, nrow - 1); |
1250 | selection_check (0); |
1258 | selection_check (0); |
1251 | } |
1259 | } |
1252 | |
1260 | |
… | |
… | |
1257 | * XTERM_SEQ: Clear line to left : ESC [ 1 K |
1265 | * XTERM_SEQ: Clear line to left : ESC [ 1 K |
1258 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1266 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1259 | * extension: clear to right unless wrapped: ESC [ 3 K |
1267 | * extension: clear to right unless wrapped: ESC [ 3 K |
1260 | */ |
1268 | */ |
1261 | void |
1269 | void |
1262 | rxvt_term::scr_erase_line (int mode) NOTHROW |
1270 | rxvt_term::scr_erase_line (int mode) noexcept |
1263 | { |
1271 | { |
1264 | unsigned int col, num; |
1272 | unsigned int col, num; |
1265 | |
1273 | |
1266 | want_refresh = 1; |
1274 | want_refresh = 1; |
1267 | ZERO_SCROLLBACK (); |
1275 | ZERO_SCROLLBACK (); |
… | |
… | |
1321 | * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J |
1329 | * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J |
1322 | * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J |
1330 | * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J |
1323 | * XTERM_SEQ: Clear whole screen : ESC [ 2 J |
1331 | * XTERM_SEQ: Clear whole screen : ESC [ 2 J |
1324 | */ |
1332 | */ |
1325 | void |
1333 | void |
1326 | rxvt_term::scr_erase_screen (int mode) NOTHROW |
1334 | rxvt_term::scr_erase_screen (int mode) noexcept |
1327 | { |
1335 | { |
1328 | int num; |
1336 | int num; |
1329 | int32_t row; |
1337 | int32_t row; |
1330 | rend_t ren; |
1338 | rend_t ren; |
1331 | XGCValues gcvalue; |
1339 | XGCValues gcvalue; |
… | |
… | |
1401 | } |
1409 | } |
1402 | } |
1410 | } |
1403 | |
1411 | |
1404 | #if !ENABLE_MINIMAL |
1412 | #if !ENABLE_MINIMAL |
1405 | void |
1413 | void |
1406 | rxvt_term::scr_erase_savelines () NOTHROW |
1414 | rxvt_term::scr_erase_savelines () noexcept |
1407 | { |
1415 | { |
1408 | want_refresh = 1; |
1416 | want_refresh = 1; |
1409 | ZERO_SCROLLBACK (); |
1417 | ZERO_SCROLLBACK (); |
1410 | |
1418 | |
1411 | top_row = 0; |
1419 | top_row = 0; |
… | |
… | |
1416 | /* |
1424 | /* |
1417 | * Fill the screen with `E's |
1425 | * Fill the screen with `E's |
1418 | * XTERM_SEQ: Screen Alignment Test: ESC # 8 |
1426 | * XTERM_SEQ: Screen Alignment Test: ESC # 8 |
1419 | */ |
1427 | */ |
1420 | void ecb_cold |
1428 | void ecb_cold |
1421 | rxvt_term::scr_E () NOTHROW |
1429 | rxvt_term::scr_E () noexcept |
1422 | { |
1430 | { |
1423 | rend_t fs; |
1431 | rend_t fs; |
1424 | |
1432 | |
1425 | want_refresh = 1; |
1433 | want_refresh = 1; |
1426 | ZERO_SCROLLBACK (); |
1434 | ZERO_SCROLLBACK (); |
… | |
… | |
1451 | /* ------------------------------------------------------------------------- */ |
1459 | /* ------------------------------------------------------------------------- */ |
1452 | /* |
1460 | /* |
1453 | * Insert/Delete <count> lines |
1461 | * Insert/Delete <count> lines |
1454 | */ |
1462 | */ |
1455 | void |
1463 | void |
1456 | rxvt_term::scr_insdel_lines (int count, int insdel) NOTHROW |
1464 | rxvt_term::scr_insdel_lines (int count, int insdel) noexcept |
1457 | { |
1465 | { |
1458 | int end; |
1466 | int end; |
1459 | |
1467 | |
1460 | ZERO_SCROLLBACK (); |
1468 | ZERO_SCROLLBACK (); |
1461 | |
1469 | |
… | |
… | |
1481 | /* ------------------------------------------------------------------------- */ |
1489 | /* ------------------------------------------------------------------------- */ |
1482 | /* |
1490 | /* |
1483 | * Insert/Delete <count> characters from the current position |
1491 | * Insert/Delete <count> characters from the current position |
1484 | */ |
1492 | */ |
1485 | void |
1493 | void |
1486 | rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW |
1494 | rxvt_term::scr_insdel_chars (int count, int insdel) noexcept |
1487 | { |
1495 | { |
1488 | want_refresh = 1; |
1496 | want_refresh = 1; |
1489 | ZERO_SCROLLBACK (); |
1497 | ZERO_SCROLLBACK (); |
1490 | |
1498 | |
1491 | if (count <= 0) |
1499 | if (count <= 0) |
… | |
… | |
1590 | /* |
1598 | /* |
1591 | * Set the scrolling region |
1599 | * Set the scrolling region |
1592 | * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r |
1600 | * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r |
1593 | */ |
1601 | */ |
1594 | void ecb_cold |
1602 | void ecb_cold |
1595 | rxvt_term::scr_scroll_region (int top, int bot) NOTHROW |
1603 | rxvt_term::scr_scroll_region (int top, int bot) noexcept |
1596 | { |
1604 | { |
1597 | max_it (top, 0); |
1605 | max_it (top, 0); |
1598 | min_it (bot, nrow - 1); |
1606 | min_it (bot, nrow - 1); |
1599 | |
1607 | |
1600 | if (top > bot) |
1608 | if (top > bot) |
… | |
… | |
1610 | * Make the cursor visible/invisible |
1618 | * Make the cursor visible/invisible |
1611 | * XTERM_SEQ: Make cursor visible : ESC [ ? 25 h |
1619 | * XTERM_SEQ: Make cursor visible : ESC [ ? 25 h |
1612 | * XTERM_SEQ: Make cursor invisible: ESC [ ? 25 l |
1620 | * XTERM_SEQ: Make cursor invisible: ESC [ ? 25 l |
1613 | */ |
1621 | */ |
1614 | void ecb_cold |
1622 | void ecb_cold |
1615 | rxvt_term::scr_cursor_visible (int mode) NOTHROW |
1623 | rxvt_term::scr_cursor_visible (int mode) noexcept |
1616 | { |
1624 | { |
1617 | want_refresh = 1; |
1625 | want_refresh = 1; |
1618 | |
1626 | |
1619 | if (mode) |
1627 | if (mode) |
1620 | screen.flags |= Screen_VisibleCursor; |
1628 | screen.flags |= Screen_VisibleCursor; |
… | |
… | |
1627 | * Set/unset automatic wrapping |
1635 | * Set/unset automatic wrapping |
1628 | * XTERM_SEQ: Set Wraparound : ESC [ ? 7 h |
1636 | * XTERM_SEQ: Set Wraparound : ESC [ ? 7 h |
1629 | * XTERM_SEQ: Unset Wraparound: ESC [ ? 7 l |
1637 | * XTERM_SEQ: Unset Wraparound: ESC [ ? 7 l |
1630 | */ |
1638 | */ |
1631 | void ecb_cold |
1639 | void ecb_cold |
1632 | rxvt_term::scr_autowrap (int mode) NOTHROW |
1640 | rxvt_term::scr_autowrap (int mode) noexcept |
1633 | { |
1641 | { |
1634 | if (mode) |
1642 | if (mode) |
1635 | screen.flags |= Screen_Autowrap; |
1643 | screen.flags |= Screen_Autowrap; |
1636 | else |
1644 | else |
1637 | screen.flags &= ~(Screen_Autowrap | Screen_WrapNext); |
1645 | screen.flags &= ~(Screen_Autowrap | Screen_WrapNext); |
… | |
… | |
1646 | * and the cursor cannot be moved outside. |
1654 | * and the cursor cannot be moved outside. |
1647 | * XTERM_SEQ: Set Absolute: ESC [ ? 6 h |
1655 | * XTERM_SEQ: Set Absolute: ESC [ ? 6 h |
1648 | * XTERM_SEQ: Set Relative: ESC [ ? 6 l |
1656 | * XTERM_SEQ: Set Relative: ESC [ ? 6 l |
1649 | */ |
1657 | */ |
1650 | void ecb_cold |
1658 | void ecb_cold |
1651 | rxvt_term::scr_relative_origin (int mode) NOTHROW |
1659 | rxvt_term::scr_relative_origin (int mode) noexcept |
1652 | { |
1660 | { |
1653 | if (mode) |
1661 | if (mode) |
1654 | screen.flags |= Screen_Relative; |
1662 | screen.flags |= Screen_Relative; |
1655 | else |
1663 | else |
1656 | screen.flags &= ~Screen_Relative; |
1664 | screen.flags &= ~Screen_Relative; |
… | |
… | |
1663 | * Set insert/replace mode |
1671 | * Set insert/replace mode |
1664 | * XTERM_SEQ: Set Insert mode : ESC [ ? 4 h |
1672 | * XTERM_SEQ: Set Insert mode : ESC [ ? 4 h |
1665 | * XTERM_SEQ: Set Replace mode: ESC [ ? 4 l |
1673 | * XTERM_SEQ: Set Replace mode: ESC [ ? 4 l |
1666 | */ |
1674 | */ |
1667 | void ecb_cold |
1675 | void ecb_cold |
1668 | rxvt_term::scr_insert_mode (int mode) NOTHROW |
1676 | rxvt_term::scr_insert_mode (int mode) noexcept |
1669 | { |
1677 | { |
1670 | if (mode) |
1678 | if (mode) |
1671 | screen.flags |= Screen_Insert; |
1679 | screen.flags |= Screen_Insert; |
1672 | else |
1680 | else |
1673 | screen.flags &= ~Screen_Insert; |
1681 | screen.flags &= ~Screen_Insert; |
… | |
… | |
1679 | * XTERM_SEQ: Set tab at current column : ESC H |
1687 | * XTERM_SEQ: Set tab at current column : ESC H |
1680 | * XTERM_SEQ: Clear tab at current column: ESC [ 0 g |
1688 | * XTERM_SEQ: Clear tab at current column: ESC [ 0 g |
1681 | * XTERM_SEQ: Clear all tabs : ESC [ 3 g |
1689 | * XTERM_SEQ: Clear all tabs : ESC [ 3 g |
1682 | */ |
1690 | */ |
1683 | void ecb_cold |
1691 | void ecb_cold |
1684 | rxvt_term::scr_set_tab (int mode) NOTHROW |
1692 | rxvt_term::scr_set_tab (int mode) noexcept |
1685 | { |
1693 | { |
1686 | if (mode < 0) |
1694 | if (mode < 0) |
1687 | memset (tabs, 0, ncol); |
1695 | memset (tabs, 0, ncol); |
1688 | else if (screen.cur.col < ncol) |
1696 | else if (screen.cur.col < ncol) |
1689 | tabs [screen.cur.col] = !!mode; |
1697 | tabs [screen.cur.col] = !!mode; |
… | |
… | |
1694 | * Set reverse/normal video |
1702 | * Set reverse/normal video |
1695 | * XTERM_SEQ: Reverse video: ESC [ ? 5 h |
1703 | * XTERM_SEQ: Reverse video: ESC [ ? 5 h |
1696 | * XTERM_SEQ: Normal video : ESC [ ? 5 l |
1704 | * XTERM_SEQ: Normal video : ESC [ ? 5 l |
1697 | */ |
1705 | */ |
1698 | void |
1706 | void |
1699 | rxvt_term::scr_rvideo_mode (bool on) NOTHROW |
1707 | rxvt_term::scr_rvideo_mode (bool on) noexcept |
1700 | { |
1708 | { |
1701 | rvideo_mode = on; |
1709 | rvideo_mode = on; |
1702 | |
1710 | |
1703 | #ifndef NO_BELL |
1711 | #ifndef NO_BELL |
1704 | on ^= rvideo_bell; |
1712 | on ^= rvideo_bell; |
… | |
… | |
1706 | |
1714 | |
1707 | if (rvideo_state != on) |
1715 | if (rvideo_state != on) |
1708 | { |
1716 | { |
1709 | rvideo_state = on; |
1717 | rvideo_state = on; |
1710 | |
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 |
1711 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1727 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1712 | #ifdef HAVE_BG_PIXMAP |
1728 | #ifdef HAVE_IMG |
1713 | if (bg_img == 0) |
1729 | if (bg_img == 0) |
1714 | #endif |
1730 | #endif |
1715 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
1731 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
1716 | |
1732 | |
1717 | XGCValues gcvalue; |
1733 | XGCValues gcvalue; |
… | |
… | |
1728 | /* |
1744 | /* |
1729 | * Report current cursor position |
1745 | * Report current cursor position |
1730 | * XTERM_SEQ: Report position: ESC [ 6 n |
1746 | * XTERM_SEQ: Report position: ESC [ 6 n |
1731 | */ |
1747 | */ |
1732 | void ecb_cold |
1748 | void ecb_cold |
1733 | rxvt_term::scr_report_position () NOTHROW |
1749 | rxvt_term::scr_report_position () noexcept |
1734 | { |
1750 | { |
1735 | 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); |
1736 | } |
1752 | } |
1737 | |
1753 | |
1738 | /* ------------------------------------------------------------------------- * |
1754 | /* ------------------------------------------------------------------------- * |
… | |
… | |
1741 | |
1757 | |
1742 | /* |
1758 | /* |
1743 | * Set font style |
1759 | * Set font style |
1744 | */ |
1760 | */ |
1745 | void ecb_cold |
1761 | void ecb_cold |
1746 | rxvt_term::set_font_style () NOTHROW |
1762 | rxvt_term::set_font_style () noexcept |
1747 | { |
1763 | { |
1748 | #if 0 |
1764 | #if 0 |
1749 | switch (charsets [screen.charset]) |
1765 | switch (charsets [screen.charset]) |
1750 | { |
1766 | { |
1751 | case '0': /* DEC Special Character & Line Drawing Set */ |
1767 | case '0': /* DEC Special Character & Line Drawing Set */ |
… | |
… | |
1773 | * XTERM_SEQ: Invoke G1 character set: CTRL-N |
1789 | * XTERM_SEQ: Invoke G1 character set: CTRL-N |
1774 | * XTERM_SEQ: Invoke G2 character set: ESC N |
1790 | * XTERM_SEQ: Invoke G2 character set: ESC N |
1775 | * XTERM_SEQ: Invoke G3 character set: ESC O |
1791 | * XTERM_SEQ: Invoke G3 character set: ESC O |
1776 | */ |
1792 | */ |
1777 | void ecb_cold |
1793 | void ecb_cold |
1778 | rxvt_term::scr_charset_choose (int set) NOTHROW |
1794 | rxvt_term::scr_charset_choose (int set) noexcept |
1779 | { |
1795 | { |
1780 | screen.charset = set; |
1796 | screen.charset = set; |
1781 | set_font_style (); |
1797 | set_font_style (); |
1782 | } |
1798 | } |
1783 | |
1799 | |
… | |
… | |
1789 | * XTERM_SEQ: Set G2 character set: ESC * <C> |
1805 | * XTERM_SEQ: Set G2 character set: ESC * <C> |
1790 | * XTERM_SEQ: Set G3 character set: ESC + <C> |
1806 | * XTERM_SEQ: Set G3 character set: ESC + <C> |
1791 | * See set_font_style for possible values for <C> |
1807 | * See set_font_style for possible values for <C> |
1792 | */ |
1808 | */ |
1793 | void |
1809 | void |
1794 | rxvt_term::scr_charset_set (int set, unsigned int ch) NOTHROW |
1810 | rxvt_term::scr_charset_set (int set, unsigned int ch) noexcept |
1795 | { |
1811 | { |
1796 | charsets[set] = (unsigned char)ch; |
1812 | charsets[set] = (unsigned char)ch; |
1797 | set_font_style (); |
1813 | set_font_style (); |
1798 | } |
1814 | } |
1799 | |
1815 | |
… | |
… | |
1804 | |
1820 | |
1805 | /* |
1821 | /* |
1806 | * refresh matching text. |
1822 | * refresh matching text. |
1807 | */ |
1823 | */ |
1808 | bool ecb_cold |
1824 | bool ecb_cold |
1809 | 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 |
1810 | { |
1826 | { |
1811 | bool found = false; |
1827 | bool found = false; |
1812 | |
1828 | |
1813 | for (int i = 0; i < nrow; i++) |
1829 | for (int i = 0; i < nrow; i++) |
1814 | { |
1830 | { |
… | |
… | |
1833 | PART_END, |
1849 | PART_END, |
1834 | RC_COUNT |
1850 | RC_COUNT |
1835 | }; |
1851 | }; |
1836 | |
1852 | |
1837 | void ecb_hot |
1853 | void ecb_hot |
1838 | 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 |
1839 | { |
1855 | { |
1840 | int i; |
1856 | int i; |
1841 | row_col_t rc[RC_COUNT]; |
1857 | row_col_t rc[RC_COUNT]; |
1842 | |
1858 | |
1843 | if (!drawn_buf) /* sanity check */ |
1859 | if (!drawn_buf) /* sanity check */ |
… | |
… | |
1877 | /* ------------------------------------------------------------------------- */ |
1893 | /* ------------------------------------------------------------------------- */ |
1878 | /* |
1894 | /* |
1879 | * Refresh the entire screen |
1895 | * Refresh the entire screen |
1880 | */ |
1896 | */ |
1881 | void |
1897 | void |
1882 | rxvt_term::scr_touch (bool refresh) NOTHROW |
1898 | rxvt_term::scr_touch (bool refresh) noexcept |
1883 | { |
1899 | { |
1884 | scr_expose (0, 0, vt_width, vt_height, refresh); |
1900 | scr_expose (0, 0, vt_width, vt_height, refresh); |
1885 | } |
1901 | } |
1886 | |
1902 | |
1887 | /* ------------------------------------------------------------------------- */ |
1903 | /* ------------------------------------------------------------------------- */ |
1888 | /* |
1904 | /* |
1889 | * 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 |
1890 | * the top of the screen |
1906 | * the top of the screen |
1891 | */ |
1907 | */ |
1892 | void |
1908 | void |
1893 | rxvt_term::scr_move_to (int y, int len) NOTHROW |
1909 | rxvt_term::scr_move_to (int y, int len) noexcept |
1894 | { |
1910 | { |
1895 | 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); |
1896 | } |
1913 | } |
1897 | |
1914 | |
1898 | /* ------------------------------------------------------------------------- */ |
1915 | /* ------------------------------------------------------------------------- */ |
1899 | /* |
1916 | /* |
1900 | * Page the screen up/down nlines |
1917 | * Page the screen up/down nlines |
1901 | * direction should be UP or DN |
1918 | * direction should be UP or DN |
1902 | */ |
1919 | */ |
1903 | bool |
1920 | bool |
1904 | rxvt_term::scr_page (enum page_dirn direction, int nlines) NOTHROW |
1921 | rxvt_term::scr_page (int nlines) noexcept |
1905 | { |
1922 | { |
1906 | int new_view_start = |
|
|
1907 | direction == UP ? view_start - nlines |
|
|
1908 | : view_start + nlines; |
|
|
1909 | |
|
|
1910 | return scr_changeview (new_view_start); |
1923 | return scr_changeview (view_start - nlines); |
1911 | } |
1924 | } |
1912 | |
1925 | |
1913 | bool |
1926 | bool |
1914 | rxvt_term::scr_changeview (int new_view_start) NOTHROW |
1927 | rxvt_term::scr_changeview (int new_view_start) noexcept |
1915 | { |
1928 | { |
1916 | clamp_it (new_view_start, top_row, 0); |
1929 | clamp_it (new_view_start, top_row, 0); |
1917 | |
1930 | |
1918 | if (new_view_start == view_start) |
1931 | if (new_view_start == view_start) |
1919 | return false; |
1932 | return false; |
… | |
… | |
1937 | } |
1950 | } |
1938 | #endif |
1951 | #endif |
1939 | |
1952 | |
1940 | /* ------------------------------------------------------------------------- */ |
1953 | /* ------------------------------------------------------------------------- */ |
1941 | void |
1954 | void |
1942 | rxvt_term::scr_bell () NOTHROW |
1955 | rxvt_term::scr_bell () noexcept |
1943 | { |
1956 | { |
1944 | #ifndef NO_BELL |
1957 | #ifndef NO_BELL |
1945 | |
1958 | |
1946 | # ifndef NO_MAPALERT |
1959 | # ifndef NO_MAPALERT |
1947 | # ifdef MAPALERT_OPTION |
1960 | # ifdef MAPALERT_OPTION |
… | |
… | |
1969 | #endif |
1982 | #endif |
1970 | } |
1983 | } |
1971 | |
1984 | |
1972 | /* ------------------------------------------------------------------------- */ |
1985 | /* ------------------------------------------------------------------------- */ |
1973 | void ecb_cold |
1986 | void ecb_cold |
1974 | rxvt_term::scr_printscreen (int fullhist) NOTHROW |
1987 | rxvt_term::scr_printscreen (int fullhist) noexcept |
1975 | { |
1988 | { |
1976 | #ifdef PRINTPIPE |
1989 | #ifdef PRINTPIPE |
1977 | int nrows, row_start; |
1990 | int nrows, row_start; |
1978 | FILE *fd = popen_printer (); |
1991 | FILE *fd = popen_printer (); |
1979 | |
1992 | |
… | |
… | |
2028 | * Refresh the screen |
2041 | * Refresh the screen |
2029 | * drawn_text/drawn_rend contain the screen information before the update. |
2042 | * drawn_text/drawn_rend contain the screen information before the update. |
2030 | * screen.text/screen.rend contain what the screen will change to. |
2043 | * screen.text/screen.rend contain what the screen will change to. |
2031 | */ |
2044 | */ |
2032 | void ecb_hot |
2045 | void ecb_hot |
2033 | rxvt_term::scr_refresh () NOTHROW |
2046 | rxvt_term::scr_refresh () noexcept |
2034 | { |
2047 | { |
2035 | int16_t col, row, /* column/row we're processing */ |
2048 | int16_t col, row, /* column/row we're processing */ |
2036 | ocrow; /* old cursor row */ |
2049 | ocrow; /* old cursor row */ |
2037 | int i; /* tmp */ |
2050 | int i; /* tmp */ |
2038 | #ifndef NO_CURSORCOLOR |
|
|
2039 | rend_t cc1; /* store colours at cursor position (s) */ |
|
|
2040 | #endif |
|
|
2041 | rend_t *crp; // cursor rendition pointer |
|
|
2042 | rend_t ccol1, /* Cursor colour */ |
2051 | rend_t ccol1, /* Cursor colour */ |
2043 | ccol2; /* Cursor colour2 */ |
2052 | ccol2; /* Cursor colour2 */ |
|
|
2053 | rend_t cur_rend; |
|
|
2054 | int cur_col; |
|
|
2055 | int cursorwidth; |
2044 | |
2056 | |
2045 | want_refresh = 0; /* screen is current */ |
2057 | want_refresh = 0; /* screen is current */ |
2046 | |
2058 | |
2047 | if (refresh_type == NO_REFRESH || !mapped) |
2059 | if (refresh_type == NO_REFRESH || !mapped) |
2048 | return; |
2060 | return; |
… | |
… | |
2052 | */ |
2064 | */ |
2053 | refresh_count = 0; |
2065 | refresh_count = 0; |
2054 | |
2066 | |
2055 | unsigned int old_screen_flags = screen.flags; |
2067 | unsigned int old_screen_flags = screen.flags; |
2056 | bool have_bg = 0; |
2068 | bool have_bg = 0; |
2057 | #ifdef HAVE_BG_PIXMAP |
2069 | #ifdef HAVE_IMG |
2058 | have_bg = bg_img != 0; |
2070 | have_bg = bg_img != 0; |
2059 | #endif |
2071 | #endif |
2060 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2072 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2061 | |
2073 | |
2062 | /* |
2074 | /* |
… | |
… | |
2073 | |
2085 | |
2074 | /* |
2086 | /* |
2075 | * C: set the cursor character (s) |
2087 | * C: set the cursor character (s) |
2076 | */ |
2088 | */ |
2077 | { |
2089 | { |
2078 | bool setoldcursor; |
|
|
2079 | |
|
|
2080 | #ifdef CURSOR_BLINK |
2090 | #ifdef CURSOR_BLINK |
2081 | if (hidden_cursor) |
2091 | if (hidden_cursor) |
2082 | showcursor = 0; |
2092 | showcursor = 0; |
2083 | #endif |
2093 | #endif |
2084 | |
2094 | |
… | |
… | |
2087 | int col = screen.cur.col; |
2097 | int col = screen.cur.col; |
2088 | |
2098 | |
2089 | while (col && ROW(screen.cur.row).t[col] == NOCHAR) |
2099 | while (col && ROW(screen.cur.row).t[col] == NOCHAR) |
2090 | col--; |
2100 | col--; |
2091 | |
2101 | |
|
|
2102 | cursorwidth = 1; |
|
|
2103 | while (col + cursorwidth < ncol |
|
|
2104 | && ROW(screen.cur.row).t[col + cursorwidth] == NOCHAR) |
|
|
2105 | cursorwidth++; |
|
|
2106 | |
2092 | crp = &ROW(screen.cur.row).r[col]; |
2107 | cur_rend = ROW(screen.cur.row).r[col]; |
|
|
2108 | cur_col = col; |
2093 | |
2109 | |
2094 | #ifndef NO_CURSORCOLOR |
2110 | #ifndef NO_CURSORCOLOR |
2095 | cc1 = *crp & (RS_fgMask | RS_bgMask); |
|
|
2096 | if (ISSET_PIXCOLOR (Color_cursor)) |
2111 | if (ISSET_PIXCOLOR (Color_cursor)) |
2097 | ccol1 = Color_cursor; |
2112 | ccol1 = Color_cursor; |
2098 | else |
2113 | else |
2099 | #endif |
2114 | #endif |
2100 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
2115 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
… | |
… | |
2112 | ccol2 = bgcolor_of (rstyle); |
2127 | ccol2 = bgcolor_of (rstyle); |
2113 | #else |
2128 | #else |
2114 | ccol2 = Color_bg; |
2129 | ccol2 = Color_bg; |
2115 | #endif |
2130 | #endif |
2116 | |
2131 | |
2117 | if (focus) |
2132 | if (focus && cursor_type == 0) |
2118 | { |
2133 | { |
2119 | if (option (Opt_cursorUnderline)) |
2134 | rend_t rend = cur_rend; |
2120 | *crp ^= RS_Uline; |
2135 | |
2121 | else |
|
|
2122 | { |
|
|
2123 | *crp ^= RS_RVid; |
2136 | rend ^= RS_RVid; |
2124 | *crp = SET_FGCOLOR (*crp, ccol1); |
2137 | rend = SET_FGCOLOR (rend, ccol1); |
2125 | *crp = SET_BGCOLOR (*crp, ccol2); |
2138 | rend = SET_BGCOLOR (rend, ccol2); |
2126 | } |
2139 | |
|
|
2140 | scr_set_char_rend (ROW(screen.cur.row), cur_col, rend); |
2127 | } |
2141 | } |
2128 | } |
2142 | } |
2129 | |
2143 | |
2130 | /* make sure no outline cursor is left around */ |
2144 | /* make sure no outline cursor is left around */ |
2131 | setoldcursor = 0; |
2145 | if (ocrow != -1 && ocrow < nrow && oldcursor.col < ncol) |
2132 | 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) |
2133 | { |
2153 | { |
2134 | if (screen.cur.row - view_start != ocrow |
2154 | oldcursor.row = screen.cur.row - view_start; |
2135 | || screen.cur.col != oldcursor.col) |
2155 | oldcursor.col = screen.cur.col; |
2136 | { |
|
|
2137 | if (ocrow < nrow |
|
|
2138 | && oldcursor.col < ncol) |
|
|
2139 | drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); |
|
|
2140 | |
|
|
2141 | if (focus || !showcursor) |
|
|
2142 | oldcursor.row = -1; |
|
|
2143 | else |
|
|
2144 | setoldcursor = 1; |
|
|
2145 | } |
|
|
2146 | } |
2156 | } |
2147 | else if (!focus) |
2157 | else |
2148 | setoldcursor = 1; |
|
|
2149 | |
|
|
2150 | if (setoldcursor) |
|
|
2151 | { |
|
|
2152 | if (screen.cur.row - view_start >= nrow) |
|
|
2153 | oldcursor.row = -1; |
2158 | oldcursor.row = -1; |
2154 | else |
|
|
2155 | { |
|
|
2156 | oldcursor.row = screen.cur.row - view_start; |
|
|
2157 | oldcursor.col = screen.cur.col; |
|
|
2158 | } |
|
|
2159 | } |
|
|
2160 | } |
2159 | } |
2161 | |
2160 | |
2162 | #ifndef NO_SLOW_LINK_SUPPORT |
2161 | #ifndef NO_SLOW_LINK_SUPPORT |
2163 | /* |
2162 | /* |
2164 | * D: CopyArea pass - very useful for slower links |
2163 | * D: CopyArea pass - very useful for slower links |
… | |
… | |
2245 | int ypixel = (int)Row2Pixel (row); |
2244 | int ypixel = (int)Row2Pixel (row); |
2246 | |
2245 | |
2247 | for (col = 0; col < ncol; col++) |
2246 | for (col = 0; col < ncol; col++) |
2248 | { |
2247 | { |
2249 | /* compare new text with old - if exactly the same then continue */ |
2248 | /* compare new text with old - if exactly the same then continue */ |
2250 | if (stp[col] == dtp[col] /* Must match characters to skip. */ |
2249 | if (stp[col] == dtp[col] && RS_SAME (srp[col], drp[col])) |
2251 | && (RS_SAME (srp[col], drp[col]) /* Either rendition the same or */ |
|
|
2252 | || (stp[col] == ' ' /* space w/ no background change */ |
|
|
2253 | && GET_BGATTR (srp[col]) == GET_BGATTR (drp[col])))) |
|
|
2254 | continue; |
2250 | continue; |
2255 | |
2251 | |
2256 | // redraw one or more characters |
2252 | // redraw one or more characters |
2257 | |
2253 | |
2258 | // seek to the beginning of wide characters |
2254 | // seek to the beginning of wide characters |
… | |
… | |
2430 | else |
2426 | else |
2431 | font->draw (*drawable, xpixel, ypixel, text, count, fore, back); |
2427 | font->draw (*drawable, xpixel, ypixel, text, count, fore, back); |
2432 | |
2428 | |
2433 | if (ecb_unlikely (rend & RS_Uline && font->descent > 1 && fore != back)) |
2429 | if (ecb_unlikely (rend & RS_Uline && font->descent > 1 && fore != back)) |
2434 | { |
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 |
2435 | #if ENABLE_FRILLS |
2435 | #if ENABLE_FRILLS |
2436 | if (ISSET_PIXCOLOR (Color_underline)) |
2436 | if (ISSET_PIXCOLOR (Color_underline)) |
2437 | XSetForeground (dpy, gc, pix_colors[Color_underline]); |
2437 | XSetForeground (dpy, gc, pix_colors[Color_underline]); |
2438 | else |
2438 | else |
2439 | #endif |
2439 | #endif |
… | |
… | |
2451 | */ |
2451 | */ |
2452 | if (showcursor) |
2452 | if (showcursor) |
2453 | { |
2453 | { |
2454 | if (focus) |
2454 | if (focus) |
2455 | { |
2455 | { |
2456 | if (option (Opt_cursorUnderline)) |
2456 | if (cursor_type == 0) |
2457 | *crp ^= RS_Uline; |
2457 | scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend); |
2458 | else |
2458 | else if (oldcursor.row >= 0) |
2459 | { |
2459 | { |
2460 | *crp ^= RS_RVid; |
2460 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2461 | #ifndef NO_CURSORCOLOR |
2461 | if (cursor_type == 1) |
2462 | *crp = (*crp & ~ (RS_fgMask | RS_bgMask)) | cc1; |
2462 | XFillRectangle (dpy, vt, gc, |
2463 | #endif |
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)); |
2464 | } |
2473 | } |
2465 | } |
2474 | } |
2466 | else if (oldcursor.row >= 0) |
2475 | else if (oldcursor.row >= 0) |
2467 | { |
2476 | { |
2468 | int cursorwidth = 1; |
|
|
2469 | int col = oldcursor.col; |
|
|
2470 | |
|
|
2471 | while (col && ROW(screen.cur.row).t[col] == NOCHAR) |
|
|
2472 | col--; |
|
|
2473 | |
|
|
2474 | while (col + cursorwidth < ncol |
|
|
2475 | && drawn_buf[oldcursor.row].t[col + cursorwidth] == NOCHAR) |
|
|
2476 | cursorwidth++; |
|
|
2477 | |
|
|
2478 | #ifndef NO_CURSORCOLOR |
|
|
2479 | if (ISSET_PIXCOLOR (Color_cursor)) |
|
|
2480 | XSetForeground (dpy, gc, pix_colors[Color_cursor]); |
|
|
2481 | else |
|
|
2482 | #endif |
|
|
2483 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2477 | XSetForeground (dpy, gc, pix_colors[ccol1]); |
2484 | |
2478 | |
2485 | XDrawRectangle (dpy, vt, gc, |
2479 | XDrawRectangle (dpy, vt, gc, |
2486 | Col2Pixel (col), |
2480 | Col2Pixel (cur_col), |
2487 | Row2Pixel (oldcursor.row), |
2481 | Row2Pixel (oldcursor.row), |
2488 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2482 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2489 | (unsigned int) (Height2Pixel (1) - 1)); |
2483 | (unsigned int) (Height2Pixel (1) - 1)); |
2490 | } |
2484 | } |
2491 | } |
2485 | } |
… | |
… | |
2504 | num_scr = 0; |
2498 | num_scr = 0; |
2505 | num_scr_allow = 1; |
2499 | num_scr_allow = 1; |
2506 | } |
2500 | } |
2507 | |
2501 | |
2508 | void ecb_cold |
2502 | void ecb_cold |
2509 | rxvt_term::scr_remap_chars (line_t &l) NOTHROW |
2503 | rxvt_term::scr_remap_chars (line_t &l) noexcept |
2510 | { |
2504 | { |
2511 | if (!l.valid ()) |
2505 | if (!l.valid ()) |
2512 | return; |
2506 | return; |
2513 | |
2507 | |
2514 | 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 |
… | |
… | |
2516 | for (int i = ncol; i--; ) |
2510 | for (int i = ncol; i--; ) |
2517 | 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])); |
2518 | } |
2512 | } |
2519 | |
2513 | |
2520 | void ecb_cold |
2514 | void ecb_cold |
2521 | rxvt_term::scr_remap_chars () NOTHROW |
2515 | rxvt_term::scr_remap_chars () noexcept |
2522 | { |
2516 | { |
2523 | for (int i = total_rows; i--; ) |
2517 | for (int i = total_rows; i--; ) |
2524 | scr_remap_chars (row_buf [i]); |
2518 | scr_remap_chars (row_buf [i]); |
2525 | |
2519 | |
2526 | for (int i = nrow; i--; ) |
2520 | for (int i = nrow; i--; ) |
… | |
… | |
2529 | scr_remap_chars (swap_buf [i]); |
2523 | scr_remap_chars (swap_buf [i]); |
2530 | } |
2524 | } |
2531 | } |
2525 | } |
2532 | |
2526 | |
2533 | void ecb_cold |
2527 | void ecb_cold |
2534 | rxvt_term::scr_recolour (bool refresh) NOTHROW |
2528 | rxvt_term::scr_recolor (bool refresh) noexcept |
2535 | { |
2529 | { |
2536 | bool transparent = false; |
2530 | bool transparent = false; |
2537 | |
2531 | |
2538 | #ifdef HAVE_BG_PIXMAP |
2532 | #ifdef HAVE_IMG |
2539 | if (bg_img != 0) |
2533 | if (bg_img != 0) |
2540 | { |
2534 | { |
2541 | # if ENABLE_TRANSPARENCY |
2535 | # if ENABLE_TRANSPARENCY |
2542 | if (bg_flags & BG_IS_TRANSPARENT) |
2536 | if (bg_flags & BG_IS_TRANSPARENT) |
2543 | { |
2537 | { |
… | |
… | |
2560 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2554 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2561 | } |
2555 | } |
2562 | |
2556 | |
2563 | XClearWindow (dpy, parent); |
2557 | XClearWindow (dpy, parent); |
2564 | |
2558 | |
2565 | if (scrollBar.win) |
2559 | if (scrollBar.state && scrollBar.win) |
2566 | { |
2560 | { |
2567 | if (transparent) |
2561 | if (transparent) |
2568 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2562 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2569 | else |
2563 | else |
2570 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); |
2564 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]); |
2571 | scrollBar.state = SB_STATE_IDLE; |
2565 | scrollBar.state = SB_STATE_IDLE; |
2572 | scrollBar.show (0); |
2566 | scrollBar.show (0); |
2573 | } |
2567 | } |
2574 | |
2568 | |
2575 | if (refresh) |
2569 | if (refresh) |
… | |
… | |
2580 | want_refresh = 1; |
2574 | want_refresh = 1; |
2581 | } |
2575 | } |
2582 | |
2576 | |
2583 | /* ------------------------------------------------------------------------- */ |
2577 | /* ------------------------------------------------------------------------- */ |
2584 | void |
2578 | void |
2585 | rxvt_term::scr_clear (bool really) NOTHROW |
2579 | rxvt_term::scr_clear (bool really) noexcept |
2586 | { |
2580 | { |
2587 | if (!mapped) |
2581 | if (!mapped) |
2588 | return; |
2582 | return; |
2589 | |
2583 | |
2590 | num_scr_allow = 0; |
2584 | num_scr_allow = 0; |
… | |
… | |
2593 | if (really) |
2587 | if (really) |
2594 | XClearWindow (dpy, vt); |
2588 | XClearWindow (dpy, vt); |
2595 | } |
2589 | } |
2596 | |
2590 | |
2597 | void |
2591 | void |
2598 | 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 |
2599 | { |
2593 | { |
2600 | int view_end = view_start + nrow; |
2594 | int view_end = view_start + nrow; |
2601 | int row, col; |
2595 | int row, col; |
2602 | |
2596 | |
2603 | 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++) |
… | |
… | |
2615 | srp[col] ^= rstyle2; |
2609 | srp[col] ^= rstyle2; |
2616 | } |
2610 | } |
2617 | } |
2611 | } |
2618 | |
2612 | |
2619 | void |
2613 | void |
2620 | 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 |
2621 | { |
2615 | { |
2622 | int view_end = view_start + nrow; |
2616 | int view_end = view_start + nrow; |
2623 | int row, col; |
2617 | int row, col; |
2624 | |
2618 | |
2625 | if (beg_row >= view_start) |
2619 | if (beg_row >= view_start) |
… | |
… | |
2642 | srp[col] ^= rstyle; |
2636 | srp[col] ^= rstyle; |
2643 | } |
2637 | } |
2644 | |
2638 | |
2645 | /* ------------------------------------------------------------------------- */ |
2639 | /* ------------------------------------------------------------------------- */ |
2646 | void ecb_hot |
2640 | void ecb_hot |
2647 | rxvt_term::scr_reverse_selection () NOTHROW |
2641 | rxvt_term::scr_reverse_selection () noexcept |
2648 | { |
2642 | { |
2649 | if (selection.op |
2643 | if (selection.op |
2650 | && current_screen == selection.screen |
2644 | && current_screen == selection.screen |
2651 | && selection.end.row >= view_start) |
2645 | && selection.end.row >= view_start) |
2652 | { |
2646 | { |
… | |
… | |
2668 | * Dump the whole scrollback and screen to the passed filedescriptor. The |
2662 | * Dump the whole scrollback and screen to the passed filedescriptor. The |
2669 | * invoking routine must close the fd. |
2663 | * invoking routine must close the fd. |
2670 | */ |
2664 | */ |
2671 | #if 0 |
2665 | #if 0 |
2672 | void |
2666 | void |
2673 | rxvt_term::scr_dump (int fd) NOTHROW |
2667 | rxvt_term::scr_dump (int fd) noexcept |
2674 | { |
2668 | { |
2675 | // 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 |
2676 | // relevant code in scr_printscreen |
2670 | // relevant code in scr_printscreen |
2677 | } |
2671 | } |
2678 | #endif |
2672 | #endif |
2679 | |
2673 | |
2680 | /* ------------------------------------------------------------------------- * |
2674 | /* ------------------------------------------------------------------------- * |
2681 | * CHARACTER SELECTION * |
2675 | * CHARACTER SELECTION * |
2682 | * ------------------------------------------------------------------------- */ |
2676 | * ------------------------------------------------------------------------- */ |
2683 | void |
2677 | void |
2684 | rxvt_term::selection_check (int check_more) NOTHROW |
2678 | rxvt_term::selection_check (int check_more) noexcept |
2685 | { |
2679 | { |
2686 | if (!selection.op) |
2680 | if (!selection.op) |
2687 | return; |
2681 | return; |
2688 | |
2682 | |
2689 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
2683 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
… | |
… | |
2694 | && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) |
2688 | && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) |
2695 | && ROWCOL_IS_BEFORE (screen.cur, selection.end))) |
2689 | && ROWCOL_IS_BEFORE (screen.cur, selection.end))) |
2696 | CLEAR_ALL_SELECTION (); |
2690 | CLEAR_ALL_SELECTION (); |
2697 | } |
2691 | } |
2698 | |
2692 | |
|
|
2693 | void |
|
|
2694 | rxvt_term::selection_changed () noexcept |
|
|
2695 | { |
|
|
2696 | line_t &r1 = ROW (selection.beg.row); |
|
|
2697 | while (selection.beg.col < r1.l && r1.t [selection.beg.col] == NOCHAR) |
|
|
2698 | ++selection.beg.col; |
|
|
2699 | |
|
|
2700 | line_t &r2 = ROW (selection.end.row); |
|
|
2701 | while (selection.end.col < r2.l && r2.t [selection.end.col] == NOCHAR) |
|
|
2702 | ++selection.end.col; |
|
|
2703 | |
|
|
2704 | want_refresh = 1; |
|
|
2705 | } |
|
|
2706 | |
2699 | /* ------------------------------------------------------------------------- */ |
2707 | /* ------------------------------------------------------------------------- */ |
2700 | /* |
2708 | /* |
2701 | * Paste a selection direct to the command fd |
2709 | * Paste a selection direct to the command fd |
2702 | */ |
2710 | */ |
2703 | void |
2711 | void |
2704 | rxvt_term::tt_paste (char *data, unsigned int len) NOTHROW |
2712 | rxvt_term::tt_paste (char *data, unsigned int len) noexcept |
2705 | { |
2713 | { |
2706 | /* convert normal newline chars into common keyboard Return key sequence */ |
2714 | /* convert normal newline chars into common keyboard Return key sequence */ |
2707 | for (unsigned int i = 0; i < len; i++) |
2715 | for (unsigned int i = 0; i < len; i++) |
2708 | if (data[i] == C0_LF) |
2716 | if (data[i] == C0_LF) |
2709 | data[i] = C0_CR; |
2717 | data[i] = C0_CR; |
2710 | |
2718 | |
2711 | if (priv_modes & PrivMode_BracketPaste) |
2719 | #if ENABLE_FRILLS |
|
|
2720 | if ((priv_modes & PrivMode_BracketPaste) && !option (Opt_disablePasteBrackets)) |
2712 | tt_printf ("\x1b[200~"); |
2721 | tt_printf ("\x1b[200~"); |
|
|
2722 | #endif |
2713 | |
2723 | |
2714 | tt_write (data, len); |
2724 | tt_write (data, len); |
2715 | |
2725 | |
2716 | if (priv_modes & PrivMode_BracketPaste) |
2726 | #if ENABLE_FRILLS |
|
|
2727 | if ((priv_modes & PrivMode_BracketPaste) && !option (Opt_disablePasteBrackets)) |
2717 | tt_printf ("\x1b[201~"); |
2728 | tt_printf ("\x1b[201~"); |
|
|
2729 | #endif |
2718 | } |
2730 | } |
2719 | |
2731 | |
2720 | void |
2732 | void |
2721 | rxvt_term::paste (char *data, unsigned int len) NOTHROW |
2733 | rxvt_term::paste (char *data, unsigned int len) noexcept |
2722 | { |
2734 | { |
2723 | 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))) |
2724 | return; |
2736 | return; |
2725 | |
2737 | |
2726 | tt_paste (data, len); |
2738 | tt_paste (data, len); |
… | |
… | |
2732 | * 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 |
2733 | * as fallback |
2745 | * as fallback |
2734 | * EXT: button 2 release |
2746 | * EXT: button 2 release |
2735 | */ |
2747 | */ |
2736 | void |
2748 | void |
2737 | rxvt_term::selection_request (Time tm, int selnum) NOTHROW |
2749 | rxvt_term::selection_request (Time tm, int selnum) noexcept |
2738 | { |
2750 | { |
2739 | if (!selection_req) |
2751 | if (!selection_req) |
2740 | { |
2752 | { |
2741 | 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); |
2742 | selection_req->run (); |
2754 | selection_req->run (); |
… | |
… | |
2747 | /* |
2759 | /* |
2748 | * Clear all selected text |
2760 | * Clear all selected text |
2749 | * EXT: SelectionClear |
2761 | * EXT: SelectionClear |
2750 | */ |
2762 | */ |
2751 | void |
2763 | void |
2752 | rxvt_term::selection_clear (bool clipboard) NOTHROW |
2764 | rxvt_term::selection_clear (bool clipboard) noexcept |
2753 | { |
2765 | { |
2754 | if (!clipboard) |
2766 | if (!clipboard) |
2755 | { |
2767 | { |
2756 | want_refresh = 1; |
2768 | want_refresh = 1; |
2757 | free (selection.text); |
2769 | free (selection.text); |
… | |
… | |
2842 | if (*t == NOCHAR) |
2854 | if (*t == NOCHAR) |
2843 | t++; |
2855 | t++; |
2844 | #if ENABLE_COMBINING |
2856 | #if ENABLE_COMBINING |
2845 | else if (IS_COMPOSE (*t)) |
2857 | else if (IS_COMPOSE (*t)) |
2846 | { |
2858 | { |
2847 | int len = rxvt_composite.expand (*t, 0); |
2859 | int len = rxvt_composite.expand (*t); |
2848 | |
2860 | |
2849 | extra -= (len - 1); |
2861 | extra -= (len - 1); |
2850 | |
2862 | |
2851 | if (extra < 0) |
2863 | if (extra < 0) |
2852 | { |
2864 | { |
… | |
… | |
2899 | |
2911 | |
2900 | selection_grab (tm); |
2912 | selection_grab (tm); |
2901 | } |
2913 | } |
2902 | |
2914 | |
2903 | bool |
2915 | bool |
2904 | rxvt_term::selection_grab (Time tm, bool clipboard) NOTHROW |
2916 | rxvt_term::selection_grab (Time tm, bool clipboard) noexcept |
2905 | { |
2917 | { |
2906 | Atom sel; |
2918 | Atom sel; |
2907 | |
2919 | |
2908 | if (!clipboard) |
2920 | if (!clipboard) |
2909 | { |
2921 | { |
… | |
… | |
2943 | /* |
2955 | /* |
2944 | * 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 |
2945 | * EXT: button 1 press |
2957 | * EXT: button 1 press |
2946 | */ |
2958 | */ |
2947 | void ecb_cold |
2959 | void ecb_cold |
2948 | rxvt_term::selection_click (int clicks, int x, int y) NOTHROW |
2960 | rxvt_term::selection_click (int clicks, int x, int y) noexcept |
2949 | { |
2961 | { |
2950 | clicks = ((clicks - 1) % 3) + 1; |
2962 | clicks = ((clicks - 1) % 3) + 1; |
2951 | selection.clicks = clicks; /* save clicks so extend will work */ |
2963 | selection.clicks = clicks; /* save clicks so extend will work */ |
2952 | |
2964 | |
2953 | if (clicks == 2 && !selection.rect |
2965 | if (clicks == 2 && !selection.rect |
… | |
… | |
2972 | /* ------------------------------------------------------------------------- */ |
2984 | /* ------------------------------------------------------------------------- */ |
2973 | /* |
2985 | /* |
2974 | * Mark a selection at the specified col/row |
2986 | * Mark a selection at the specified col/row |
2975 | */ |
2987 | */ |
2976 | void ecb_cold |
2988 | void ecb_cold |
2977 | rxvt_term::selection_start_colrow (int col, int row) NOTHROW |
2989 | rxvt_term::selection_start_colrow (int col, int row) noexcept |
2978 | { |
2990 | { |
2979 | want_refresh = 1; |
2991 | want_refresh = 1; |
2980 | |
2992 | |
2981 | selection.mark.row = row + view_start; |
2993 | selection.mark.row = row + view_start; |
2982 | selection.mark.col = col; |
2994 | selection.mark.col = col; |
… | |
… | |
3004 | * Word select: select text for 2 clicks |
3016 | * Word select: select text for 2 clicks |
3005 | * We now only find out the boundary in one direction |
3017 | * We now only find out the boundary in one direction |
3006 | */ |
3018 | */ |
3007 | |
3019 | |
3008 | /* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */ |
3020 | /* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */ |
3009 | #define DELIMIT_TEXT(x) \ |
3021 | #define DELIMIT_TEXT(x) \ |
3010 | (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))) |
3011 | #define DELIMIT_REND(x) 1 |
3023 | #define DELIMIT_REND(x) 1 |
3012 | |
3024 | |
3013 | void ecb_cold |
3025 | void ecb_cold |
3014 | 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 |
3015 | { |
3027 | { |
3016 | int col, row, dirnadd, tcol, trow, w1, w2; |
3028 | int col, row, dirnadd, tcol, trow, w1, w2; |
3017 | row_col_t bound; |
3029 | row_col_t bound; |
3018 | text_t *stp; |
3030 | text_t *stp; |
3019 | rend_t *srp; |
3031 | rend_t *srp; |
… | |
… | |
3093 | * flag == 0 ==> button 1 |
3105 | * flag == 0 ==> button 1 |
3094 | * flag == 1 ==> button 3 press |
3106 | * flag == 1 ==> button 3 press |
3095 | * flag == 2 ==> button 3 motion |
3107 | * flag == 2 ==> button 3 motion |
3096 | */ |
3108 | */ |
3097 | void ecb_cold |
3109 | void ecb_cold |
3098 | rxvt_term::selection_extend (int x, int y, int flag) NOTHROW |
3110 | rxvt_term::selection_extend (int x, int y, int flag) noexcept |
3099 | { |
3111 | { |
3100 | int col = clamp (Pixel2Col (x), 0, ncol); |
3112 | int col = clamp (Pixel2Col (x), 0, ncol); |
3101 | int row = clamp (Pixel2Row (y), 0, nrow - 1); |
3113 | int row = clamp (Pixel2Row (y), 0, nrow - 1); |
3102 | |
3114 | |
3103 | /* |
3115 | /* |
… | |
… | |
3129 | /* ------------------------------------------------------------------------- */ |
3141 | /* ------------------------------------------------------------------------- */ |
3130 | /* |
3142 | /* |
3131 | * Extend the selection to the specified col/row |
3143 | * Extend the selection to the specified col/row |
3132 | */ |
3144 | */ |
3133 | void ecb_cold |
3145 | void ecb_cold |
3134 | 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 |
3135 | { |
3147 | { |
3136 | row_col_t pos; |
3148 | row_col_t pos; |
3137 | enum { |
3149 | enum { |
3138 | LEFT, RIGHT |
3150 | LEFT, RIGHT |
3139 | } closeto = RIGHT; |
3151 | } closeto = RIGHT; |
3140 | |
|
|
3141 | want_refresh = 1; |
|
|
3142 | |
3152 | |
3143 | switch (selection.op) |
3153 | switch (selection.op) |
3144 | { |
3154 | { |
3145 | case SELECTION_INIT: |
3155 | case SELECTION_INIT: |
3146 | CLEAR_SELECTION (); |
3156 | CLEAR_SELECTION (); |
… | |
… | |
3326 | |
3336 | |
3327 | #if !ENABLE_MINIMAL |
3337 | #if !ENABLE_MINIMAL |
3328 | if (selection.rect && selection.beg.col > selection.end.col) |
3338 | if (selection.rect && selection.beg.col > selection.end.col) |
3329 | ::swap (selection.beg.col, selection.end.col); |
3339 | ::swap (selection.beg.col, selection.end.col); |
3330 | #endif |
3340 | #endif |
|
|
3341 | |
|
|
3342 | selection_changed (); |
3331 | } |
3343 | } |
3332 | |
3344 | |
3333 | #if !ENABLE_MINIMAL |
3345 | #if !ENABLE_MINIMAL |
3334 | void ecb_cold |
3346 | void ecb_cold |
3335 | rxvt_term::selection_remove_trailing_spaces () NOTHROW |
3347 | rxvt_term::selection_remove_trailing_spaces () noexcept |
3336 | { |
3348 | { |
3337 | int32_t end_col, end_row; |
3349 | int32_t end_col, end_row; |
3338 | text_t *stp; |
3350 | text_t *stp; |
3339 | |
3351 | |
3340 | end_col = selection.end.col; |
3352 | end_col = selection.end.col; |
… | |
… | |
3378 | /* |
3390 | /* |
3379 | * Double click on button 3 when already selected |
3391 | * Double click on button 3 when already selected |
3380 | * EXT: button 3 double click |
3392 | * EXT: button 3 double click |
3381 | */ |
3393 | */ |
3382 | void ecb_cold |
3394 | void ecb_cold |
3383 | rxvt_term::selection_rotate (int x, int y) NOTHROW |
3395 | rxvt_term::selection_rotate (int x, int y) noexcept |
3384 | { |
3396 | { |
3385 | selection.clicks = selection.clicks % 3 + 1; |
3397 | selection.clicks = selection.clicks % 3 + 1; |
3386 | selection_extend_colrow (Pixel2Col (x), Pixel2Row (y), 1, 0, 1); |
3398 | selection_extend_colrow (Pixel2Col (x), Pixel2Row (y), 1, 0, 1); |
3387 | } |
3399 | } |
3388 | |
3400 | |
… | |
… | |
3390 | /* |
3402 | /* |
3391 | * Respond to a request for our current selection |
3403 | * Respond to a request for our current selection |
3392 | * EXT: SelectionRequest |
3404 | * EXT: SelectionRequest |
3393 | */ |
3405 | */ |
3394 | void ecb_cold |
3406 | void ecb_cold |
3395 | rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW |
3407 | rxvt_term::selection_send (const XSelectionRequestEvent &rq) noexcept |
3396 | { |
3408 | { |
3397 | Atom property = rq.property == None ? rq.target : rq.property; |
3409 | Atom property = rq.property == None ? rq.target : rq.property; |
3398 | XSelectionEvent ev; |
3410 | XSelectionEvent ev; |
3399 | |
3411 | |
3400 | ev.type = SelectionNotify; |
3412 | ev.type = SelectionNotify; |
… | |
… | |
3492 | cl = selection.clip_text; |
3504 | cl = selection.clip_text; |
3493 | selectlen = selection.clip_len; |
3505 | selectlen = selection.clip_len; |
3494 | } |
3506 | } |
3495 | else |
3507 | else |
3496 | { |
3508 | { |
3497 | cl = L""; |
3509 | cl = (wchar_t *)L""; |
3498 | selectlen = 0; |
3510 | selectlen = 0; |
3499 | } |
3511 | } |
3500 | |
3512 | |
3501 | #if !ENABLE_MINIMAL |
3513 | #if !ENABLE_MINIMAL |
3502 | // 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 |
… | |
… | |
3534 | } |
3546 | } |
3535 | |
3547 | |
3536 | /* ------------------------------------------------------------------------- */ |
3548 | /* ------------------------------------------------------------------------- */ |
3537 | #if USE_XIM |
3549 | #if USE_XIM |
3538 | void ecb_cold |
3550 | void ecb_cold |
3539 | rxvt_term::im_set_position (XPoint &pos) NOTHROW |
3551 | rxvt_term::im_set_position (XPoint &pos) noexcept |
3540 | { |
3552 | { |
3541 | XWindowAttributes xwa; |
3553 | XWindowAttributes xwa; |
3542 | |
3554 | |
3543 | XGetWindowAttributes (dpy, vt, &xwa); |
3555 | XGetWindowAttributes (dpy, vt, &xwa); |
3544 | |
3556 | |
… | |
… | |
3547 | } |
3559 | } |
3548 | #endif |
3560 | #endif |
3549 | |
3561 | |
3550 | #if ENABLE_OVERLAY |
3562 | #if ENABLE_OVERLAY |
3551 | void |
3563 | void |
3552 | 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 |
3553 | { |
3565 | { |
3554 | if (nrow < 1 || ncol < 1) |
3566 | if (nrow < 1 || ncol < 1) |
3555 | return; |
3567 | return; |
3556 | |
3568 | |
3557 | want_refresh = 1; |
3569 | want_refresh = 1; |
… | |
… | |
3602 | *rp = r; |
3614 | *rp = r; |
3603 | } |
3615 | } |
3604 | } |
3616 | } |
3605 | |
3617 | |
3606 | void |
3618 | void |
3607 | rxvt_term::scr_overlay_off () NOTHROW |
3619 | rxvt_term::scr_overlay_off () noexcept |
3608 | { |
3620 | { |
3609 | if (!ov.text) |
3621 | if (!ov.text) |
3610 | return; |
3622 | return; |
3611 | |
3623 | |
3612 | want_refresh = 1; |
3624 | want_refresh = 1; |
… | |
… | |
3620 | delete [] ov.text; ov.text = 0; |
3632 | delete [] ov.text; ov.text = 0; |
3621 | delete [] ov.rend; ov.rend = 0; |
3633 | delete [] ov.rend; ov.rend = 0; |
3622 | } |
3634 | } |
3623 | |
3635 | |
3624 | void |
3636 | void |
3625 | 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 |
3626 | { |
3638 | { |
3627 | if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2) |
3639 | if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2) |
3628 | return; |
3640 | return; |
3629 | |
3641 | |
3630 | x++, y++; |
3642 | x++, y++; |
… | |
… | |
3632 | ov.text[y][x] = text; |
3644 | ov.text[y][x] = text; |
3633 | ov.rend[y][x] = rend; |
3645 | ov.rend[y][x] = rend; |
3634 | } |
3646 | } |
3635 | |
3647 | |
3636 | void |
3648 | void |
3637 | 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 |
3638 | { |
3650 | { |
3639 | while (*s) |
3651 | while (*s) |
3640 | scr_overlay_set (x++, y, *s++); |
3652 | scr_overlay_set (x++, y, *s++); |
3641 | } |
3653 | } |
3642 | |
3654 | |
3643 | void |
3655 | void |
3644 | 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 |
3645 | { |
3657 | { |
3646 | while (*s) |
3658 | while (*s) |
3647 | { |
3659 | { |
3648 | text_t t = *s++; |
3660 | text_t t = *s++; |
3649 | int width = WCWIDTH (t); |
3661 | int width = WCWIDTH (t); |
… | |
… | |
3655 | } |
3667 | } |
3656 | } |
3668 | } |
3657 | } |
3669 | } |
3658 | |
3670 | |
3659 | void |
3671 | void |
3660 | rxvt_term::scr_swap_overlay () NOTHROW |
3672 | rxvt_term::scr_swap_overlay () noexcept |
3661 | { |
3673 | { |
3662 | if (!ov.text) |
3674 | if (!ov.text) |
3663 | return; |
3675 | return; |
3664 | |
3676 | |
3665 | // hide cursor if it is within the overlay area |
3677 | // hide cursor if it is within the overlay area |