ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/screen.C
(Generate patch)

Comparing rxvt-unicode/src/screen.C (file contents):
Revision 1.454 by sf-exg, Sun Jan 18 13:08:46 2015 UTC vs.
Revision 1.464 by root, Thu Aug 4 18:11:59 2022 UTC

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 3 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.
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. */
98void 99void
99rxvt_term::scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW 100rxvt_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 */
125void 126void
126rxvt_term::scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW 127rxvt_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
135void 136void
136rxvt_term::scr_kill_char (line_t &l, int col) const NOTHROW 137rxvt_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
169void 170void
170rxvt_term::scr_alloc () NOTHROW 171rxvt_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
329 llen += prev_ncol; 332 llen += prev_ncol;
330 } 333 }
331 334
332 int qlines = max (0, (llen - 1) / ncol) + 1; 335 int qlines = max (0, (llen - 1) / ncol) + 1;
333 336
337 q -= qlines;
338
334 // drop partial lines completely 339 // drop partial lines completely
335 if (q < qlines) 340 if (q < 0)
336 break; 341 break;
337
338 q -= qlines;
339 342
340 int lofs = 0; 343 int lofs = 0;
341 line_t *qline; 344 line_t *qline;
342 345
343 // re-assemble the full line by destination lines 346 // re-assemble the full line by destination lines
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
398 { 397 do
399 // if no scrollback exists (yet), wing, instead of wrap
400
401 for (int row = min (nrow, prev_nrow); row--; )
402 { 398 {
403 line_t &src = prev_row_buf [MOD (term_start + row, prev_total_rows)]; 399 p = MOD (p - 1, prev_total_rows);
404 line_t &dst = row_buf [row]; 400 q--;
405 401
406 copy_line (dst, src); 402 copy_line (row_buf [q], prev_row_buf [p]);
407 } 403 }
404 while (p != pend);
405 }
408 406
409 for (int row = prev_nrow; row < nrow; row++) 407 term_start = total_rows - nrow;
408 top_row = q - term_start;
409
410 // make sure all terminal lines exist
411 while (top_row > 0)
410 scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); 412 scr_blank_screen_mem (ROW (--top_row), DEFAULT_RSTYLE);
411
412 term_start = 0;
413 }
414 413
415 clamp_it (screen.cur.row, 0, nrow - 1); 414 clamp_it (screen.cur.row, 0, nrow - 1);
416 clamp_it (screen.cur.col, 0, ncol - 1); 415 clamp_it (screen.cur.col, 0, ncol - 1);
417 } 416 }
418 417
440 439
441 HOOK_INVOKE ((this, HOOK_RESET, DT_END)); 440 HOOK_INVOKE ((this, HOOK_RESET, DT_END));
442} 441}
443 442
444void ecb_cold 443void ecb_cold
445rxvt_term::scr_release () NOTHROW 444rxvt_term::scr_release () noexcept
446{ 445{
447 chunk_free (chunk, chunk_size); 446 chunk_free (chunk, chunk_size);
448 chunk = 0; 447 chunk = 0;
449 row_buf = 0; 448 row_buf = 0;
450 449
469 scr_clear (true); 468 scr_clear (true);
470 scr_refresh (); 469 scr_refresh ();
471} 470}
472 471
473void ecb_cold 472void ecb_cold
474rxvt_term::scr_soft_reset () NOTHROW 473rxvt_term::scr_soft_reset () noexcept
475{ 474{
476 /* only affects modes, nothing drastic such as clearing the screen */ 475 /* only affects modes, nothing drastic such as clearing the screen */
477#if ENABLE_OVERLAY 476#if ENABLE_OVERLAY
478 scr_overlay_off (); 477 scr_overlay_off ();
479#endif 478#endif
493 * Save and Restore cursor 492 * Save and Restore cursor
494 * XTERM_SEQ: Save cursor : ESC 7 493 * XTERM_SEQ: Save cursor : ESC 7
495 * XTERM_SEQ: Restore cursor: ESC 8 494 * XTERM_SEQ: Restore cursor: ESC 8
496 */ 495 */
497void 496void
498rxvt_term::scr_cursor (cursor_mode mode) NOTHROW 497rxvt_term::scr_cursor (cursor_mode mode) noexcept
499{ 498{
500 screen_t *s; 499 screen_t *s;
501 500
502#if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) 501#if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR)
503 if (current_screen == SECONDARY) 502 if (current_screen == SECONDARY)
534 assert (s->cur.row >= 0); 533 assert (s->cur.row >= 0);
535 assert (s->cur.col >= 0); 534 assert (s->cur.col >= 0);
536} 535}
537 536
538void 537void
539rxvt_term::scr_swap_screen () NOTHROW 538rxvt_term::scr_swap_screen () noexcept
540{ 539{
541 if (!option (Opt_secondaryScreen)) 540 if (!option (Opt_secondaryScreen))
542 return; 541 return;
543 542
544 for (int i = prev_nrow; i--; ) 543 for (int i = prev_nrow; i--; )
592 scr_scroll_text (0, prev_nrow - 1, prev_nrow); 591 scr_scroll_text (0, prev_nrow - 1, prev_nrow);
593} 592}
594 593
595// clear WrapNext indicator, solidifying position on next line 594// clear WrapNext indicator, solidifying position on next line
596void 595void
597rxvt_term::scr_do_wrap () NOTHROW 596rxvt_term::scr_do_wrap () noexcept
598{ 597{
599 if (!(screen.flags & Screen_WrapNext)) 598 if (!(screen.flags & Screen_WrapNext))
600 return; 599 return;
601 600
602 screen.flags &= ~Screen_WrapNext; 601 screen.flags &= ~Screen_WrapNext;
612/* ------------------------------------------------------------------------- */ 611/* ------------------------------------------------------------------------- */
613/* 612/*
614 * Change the colour for following text 613 * Change the colour for following text
615 */ 614 */
616void 615void
617rxvt_term::scr_color (unsigned int color, int fgbg) NOTHROW 616rxvt_term::scr_color (unsigned int color, int fgbg) noexcept
618{ 617{
619 if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) 618 if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR24))
620 color = fgbg; 619 color = fgbg;
621 620
622 if (fgbg == Color_fg) 621 if (fgbg == Color_fg)
623 rstyle = SET_FGCOLOR (rstyle, color); 622 rstyle = SET_FGCOLOR (rstyle, color);
624 else 623 else
628/* ------------------------------------------------------------------------- */ 627/* ------------------------------------------------------------------------- */
629/* 628/*
630 * Change the rendition style for following text 629 * Change the rendition style for following text
631 */ 630 */
632void 631void
633rxvt_term::scr_rendition (int set, int style) NOTHROW 632rxvt_term::scr_rendition (int set, int style) noexcept
634{ 633{
635 if (set) 634 if (set)
636 rstyle |= style; 635 rstyle |= style;
637 else if (style == ~RS_None) 636 else if (style == ~RS_None)
638 rstyle = DEFAULT_RSTYLE; 637 rstyle = DEFAULT_RSTYLE;
645 * Scroll text between <row1> and <row2> inclusive, by <count> lines 644 * Scroll text between <row1> and <row2> inclusive, by <count> lines
646 * count positive ==> scroll up 645 * count positive ==> scroll up
647 * count negative ==> scroll down 646 * count negative ==> scroll down
648 */ 647 */
649int ecb_hot 648int ecb_hot
650rxvt_term::scr_scroll_text (int row1, int row2, int count) NOTHROW 649rxvt_term::scr_scroll_text (int row1, int row2, int count) noexcept
651{ 650{
652 if (count == 0 || (row1 > row2)) 651 if (count == 0 || (row1 > row2))
653 return 0; 652 return 0;
654 653
655 want_refresh = 1; 654 want_refresh = 1;
789/* ------------------------------------------------------------------------- */ 788/* ------------------------------------------------------------------------- */
790/* 789/*
791 * Add text given in <str> of length <len> to screen struct 790 * Add text given in <str> of length <len> to screen struct
792 */ 791 */
793void ecb_hot 792void ecb_hot
794rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) NOTHROW 793rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) noexcept
795{ 794{
796 if (len <= 0) /* sanity */ 795 if (len <= 0) /* sanity */
797 return; 796 return;
798 797
799 bool checksel; 798 bool checksel;
1011 } 1010 }
1012 else if (screen.cur.row > 0 1011 else if (screen.cur.row > 0
1013 && ROW(screen.cur.row - 1).is_longer ()) 1012 && ROW(screen.cur.row - 1).is_longer ())
1014 { 1013 {
1015 linep = &ROW(screen.cur.row - 1); 1014 linep = &ROW(screen.cur.row - 1);
1016 tp = line->t + ncol - 1; 1015 tp = linep->t + ncol - 1;
1017 rp = line->r + ncol - 1; 1016 rp = linep->r + ncol - 1;
1018 } 1017 }
1019 else 1018 else
1020 continue; 1019 continue;
1021 1020
1022 linep->touch (); 1021 linep->touch ();
1045/* 1044/*
1046 * Process Backspace. Move back the cursor back a position, wrap if have to 1045 * Process Backspace. Move back the cursor back a position, wrap if have to
1047 * XTERM_SEQ: CTRL-H 1046 * XTERM_SEQ: CTRL-H
1048 */ 1047 */
1049void 1048void
1050rxvt_term::scr_backspace () NOTHROW 1049rxvt_term::scr_backspace () noexcept
1051{ 1050{
1052 if (screen.cur.col == 0) 1051 if (screen.cur.col == 0)
1053 { 1052 {
1054 if (screen.cur.row > 0) 1053 if (screen.cur.row > 0)
1055 { 1054 {
1072 * Process Horizontal Tab 1071 * Process Horizontal Tab
1073 * count: +ve = forward; -ve = backwards 1072 * count: +ve = forward; -ve = backwards
1074 * XTERM_SEQ: CTRL-I 1073 * XTERM_SEQ: CTRL-I
1075 */ 1074 */
1076void 1075void
1077rxvt_term::scr_tab (int count, bool ht) NOTHROW 1076rxvt_term::scr_tab (int count, bool ht) noexcept
1078{ 1077{
1079 int i, x; 1078 int i, x;
1080 1079
1081 want_refresh = 1; 1080 want_refresh = 1;
1082 i = x = screen.cur.col; 1081 i = x = screen.cur.col;
1149 * Move cursor left in row. If we're at the left boundary, shift everything 1148 * Move cursor left in row. If we're at the left boundary, shift everything
1150 * in that row right. Clear left column. 1149 * in that row right. Clear left column.
1151 */ 1150 */
1152#if !ENABLE_MINIMAL 1151#if !ENABLE_MINIMAL
1153void ecb_cold 1152void ecb_cold
1154rxvt_term::scr_backindex () NOTHROW 1153rxvt_term::scr_backindex () noexcept
1155{ 1154{
1156 if (screen.cur.col > 0) 1155 if (screen.cur.col > 0)
1157 scr_gotorc (0, -1, R_RELATIVE | C_RELATIVE); 1156 scr_gotorc (0, -1, R_RELATIVE | C_RELATIVE);
1158 else 1157 else
1159 scr_insdel_chars (1, INSERT); 1158 scr_insdel_chars (1, INSERT);
1166 * Move cursor right in row. If we're at the right boundary, shift everything 1165 * Move cursor right in row. If we're at the right boundary, shift everything
1167 * in that row left. Clear right column. 1166 * in that row left. Clear right column.
1168 */ 1167 */
1169#if !ENABLE_MINIMAL 1168#if !ENABLE_MINIMAL
1170void ecb_cold 1169void ecb_cold
1171rxvt_term::scr_forwardindex () NOTHROW 1170rxvt_term::scr_forwardindex () noexcept
1172{ 1171{
1173 if (screen.cur.col < ncol - 1) 1172 if (screen.cur.col < ncol - 1)
1174 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); 1173 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE);
1175 else 1174 else
1176 { 1175 {
1189/* ------------------------------------------------------------------------- */ 1188/* ------------------------------------------------------------------------- */
1190/* 1189/*
1191 * Goto Row/Column 1190 * Goto Row/Column
1192 */ 1191 */
1193void 1192void
1194rxvt_term::scr_gotorc (int row, int col, int relative) NOTHROW 1193rxvt_term::scr_gotorc (int row, int col, int relative) noexcept
1195{ 1194{
1196 want_refresh = 1; 1195 want_refresh = 1;
1197 ZERO_SCROLLBACK (); 1196 ZERO_SCROLLBACK ();
1198 1197
1199 screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; 1198 screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col;
1238/* ------------------------------------------------------------------------- */ 1237/* ------------------------------------------------------------------------- */
1239/* 1238/*
1240 * direction should be UP or DN 1239 * direction should be UP or DN
1241 */ 1240 */
1242void 1241void
1243rxvt_term::scr_index (enum page_dirn direction) NOTHROW 1242rxvt_term::scr_index (enum page_dirn direction) noexcept
1244{ 1243{
1245 want_refresh = 1; 1244 want_refresh = 1;
1246 ZERO_SCROLLBACK (); 1245 ZERO_SCROLLBACK ();
1247 1246
1248 screen.flags &= ~Screen_WrapNext; 1247 screen.flags &= ~Screen_WrapNext;
1264 * XTERM_SEQ: Clear line to left : ESC [ 1 K 1263 * XTERM_SEQ: Clear line to left : ESC [ 1 K
1265 * XTERM_SEQ: Clear whole line : ESC [ 2 K 1264 * XTERM_SEQ: Clear whole line : ESC [ 2 K
1266 * extension: clear to right unless wrapped: ESC [ 3 K 1265 * extension: clear to right unless wrapped: ESC [ 3 K
1267 */ 1266 */
1268void 1267void
1269rxvt_term::scr_erase_line (int mode) NOTHROW 1268rxvt_term::scr_erase_line (int mode) noexcept
1270{ 1269{
1271 unsigned int col, num; 1270 unsigned int col, num;
1272 1271
1273 want_refresh = 1; 1272 want_refresh = 1;
1274 ZERO_SCROLLBACK (); 1273 ZERO_SCROLLBACK ();
1328 * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J 1327 * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J
1329 * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J 1328 * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J
1330 * XTERM_SEQ: Clear whole screen : ESC [ 2 J 1329 * XTERM_SEQ: Clear whole screen : ESC [ 2 J
1331 */ 1330 */
1332void 1331void
1333rxvt_term::scr_erase_screen (int mode) NOTHROW 1332rxvt_term::scr_erase_screen (int mode) noexcept
1334{ 1333{
1335 int num; 1334 int num;
1336 int32_t row; 1335 int32_t row;
1337 rend_t ren; 1336 rend_t ren;
1338 XGCValues gcvalue; 1337 XGCValues gcvalue;
1408 } 1407 }
1409} 1408}
1410 1409
1411#if !ENABLE_MINIMAL 1410#if !ENABLE_MINIMAL
1412void 1411void
1413rxvt_term::scr_erase_savelines () NOTHROW 1412rxvt_term::scr_erase_savelines () noexcept
1414{ 1413{
1415 want_refresh = 1; 1414 want_refresh = 1;
1416 ZERO_SCROLLBACK (); 1415 ZERO_SCROLLBACK ();
1417 1416
1418 top_row = 0; 1417 top_row = 0;
1423/* 1422/*
1424 * Fill the screen with `E's 1423 * Fill the screen with `E's
1425 * XTERM_SEQ: Screen Alignment Test: ESC # 8 1424 * XTERM_SEQ: Screen Alignment Test: ESC # 8
1426 */ 1425 */
1427void ecb_cold 1426void ecb_cold
1428rxvt_term::scr_E () NOTHROW 1427rxvt_term::scr_E () noexcept
1429{ 1428{
1430 rend_t fs; 1429 rend_t fs;
1431 1430
1432 want_refresh = 1; 1431 want_refresh = 1;
1433 ZERO_SCROLLBACK (); 1432 ZERO_SCROLLBACK ();
1458/* ------------------------------------------------------------------------- */ 1457/* ------------------------------------------------------------------------- */
1459/* 1458/*
1460 * Insert/Delete <count> lines 1459 * Insert/Delete <count> lines
1461 */ 1460 */
1462void 1461void
1463rxvt_term::scr_insdel_lines (int count, int insdel) NOTHROW 1462rxvt_term::scr_insdel_lines (int count, int insdel) noexcept
1464{ 1463{
1465 int end; 1464 int end;
1466 1465
1467 ZERO_SCROLLBACK (); 1466 ZERO_SCROLLBACK ();
1468 1467
1488/* ------------------------------------------------------------------------- */ 1487/* ------------------------------------------------------------------------- */
1489/* 1488/*
1490 * Insert/Delete <count> characters from the current position 1489 * Insert/Delete <count> characters from the current position
1491 */ 1490 */
1492void 1491void
1493rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW 1492rxvt_term::scr_insdel_chars (int count, int insdel) noexcept
1494{ 1493{
1495 want_refresh = 1; 1494 want_refresh = 1;
1496 ZERO_SCROLLBACK (); 1495 ZERO_SCROLLBACK ();
1497 1496
1498 if (count <= 0) 1497 if (count <= 0)
1597/* 1596/*
1598 * Set the scrolling region 1597 * Set the scrolling region
1599 * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r 1598 * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r
1600 */ 1599 */
1601void ecb_cold 1600void ecb_cold
1602rxvt_term::scr_scroll_region (int top, int bot) NOTHROW 1601rxvt_term::scr_scroll_region (int top, int bot) noexcept
1603{ 1602{
1604 max_it (top, 0); 1603 max_it (top, 0);
1605 min_it (bot, nrow - 1); 1604 min_it (bot, nrow - 1);
1606 1605
1607 if (top > bot) 1606 if (top > bot)
1617 * Make the cursor visible/invisible 1616 * Make the cursor visible/invisible
1618 * XTERM_SEQ: Make cursor visible : ESC [ ? 25 h 1617 * XTERM_SEQ: Make cursor visible : ESC [ ? 25 h
1619 * XTERM_SEQ: Make cursor invisible: ESC [ ? 25 l 1618 * XTERM_SEQ: Make cursor invisible: ESC [ ? 25 l
1620 */ 1619 */
1621void ecb_cold 1620void ecb_cold
1622rxvt_term::scr_cursor_visible (int mode) NOTHROW 1621rxvt_term::scr_cursor_visible (int mode) noexcept
1623{ 1622{
1624 want_refresh = 1; 1623 want_refresh = 1;
1625 1624
1626 if (mode) 1625 if (mode)
1627 screen.flags |= Screen_VisibleCursor; 1626 screen.flags |= Screen_VisibleCursor;
1634 * Set/unset automatic wrapping 1633 * Set/unset automatic wrapping
1635 * XTERM_SEQ: Set Wraparound : ESC [ ? 7 h 1634 * XTERM_SEQ: Set Wraparound : ESC [ ? 7 h
1636 * XTERM_SEQ: Unset Wraparound: ESC [ ? 7 l 1635 * XTERM_SEQ: Unset Wraparound: ESC [ ? 7 l
1637 */ 1636 */
1638void ecb_cold 1637void ecb_cold
1639rxvt_term::scr_autowrap (int mode) NOTHROW 1638rxvt_term::scr_autowrap (int mode) noexcept
1640{ 1639{
1641 if (mode) 1640 if (mode)
1642 screen.flags |= Screen_Autowrap; 1641 screen.flags |= Screen_Autowrap;
1643 else 1642 else
1644 screen.flags &= ~(Screen_Autowrap | Screen_WrapNext); 1643 screen.flags &= ~(Screen_Autowrap | Screen_WrapNext);
1653 * and the cursor cannot be moved outside. 1652 * and the cursor cannot be moved outside.
1654 * XTERM_SEQ: Set Absolute: ESC [ ? 6 h 1653 * XTERM_SEQ: Set Absolute: ESC [ ? 6 h
1655 * XTERM_SEQ: Set Relative: ESC [ ? 6 l 1654 * XTERM_SEQ: Set Relative: ESC [ ? 6 l
1656 */ 1655 */
1657void ecb_cold 1656void ecb_cold
1658rxvt_term::scr_relative_origin (int mode) NOTHROW 1657rxvt_term::scr_relative_origin (int mode) noexcept
1659{ 1658{
1660 if (mode) 1659 if (mode)
1661 screen.flags |= Screen_Relative; 1660 screen.flags |= Screen_Relative;
1662 else 1661 else
1663 screen.flags &= ~Screen_Relative; 1662 screen.flags &= ~Screen_Relative;
1670 * Set insert/replace mode 1669 * Set insert/replace mode
1671 * XTERM_SEQ: Set Insert mode : ESC [ ? 4 h 1670 * XTERM_SEQ: Set Insert mode : ESC [ ? 4 h
1672 * XTERM_SEQ: Set Replace mode: ESC [ ? 4 l 1671 * XTERM_SEQ: Set Replace mode: ESC [ ? 4 l
1673 */ 1672 */
1674void ecb_cold 1673void ecb_cold
1675rxvt_term::scr_insert_mode (int mode) NOTHROW 1674rxvt_term::scr_insert_mode (int mode) noexcept
1676{ 1675{
1677 if (mode) 1676 if (mode)
1678 screen.flags |= Screen_Insert; 1677 screen.flags |= Screen_Insert;
1679 else 1678 else
1680 screen.flags &= ~Screen_Insert; 1679 screen.flags &= ~Screen_Insert;
1686 * XTERM_SEQ: Set tab at current column : ESC H 1685 * XTERM_SEQ: Set tab at current column : ESC H
1687 * XTERM_SEQ: Clear tab at current column: ESC [ 0 g 1686 * XTERM_SEQ: Clear tab at current column: ESC [ 0 g
1688 * XTERM_SEQ: Clear all tabs : ESC [ 3 g 1687 * XTERM_SEQ: Clear all tabs : ESC [ 3 g
1689 */ 1688 */
1690void ecb_cold 1689void ecb_cold
1691rxvt_term::scr_set_tab (int mode) NOTHROW 1690rxvt_term::scr_set_tab (int mode) noexcept
1692{ 1691{
1693 if (mode < 0) 1692 if (mode < 0)
1694 memset (tabs, 0, ncol); 1693 memset (tabs, 0, ncol);
1695 else if (screen.cur.col < ncol) 1694 else if (screen.cur.col < ncol)
1696 tabs [screen.cur.col] = !!mode; 1695 tabs [screen.cur.col] = !!mode;
1701 * Set reverse/normal video 1700 * Set reverse/normal video
1702 * XTERM_SEQ: Reverse video: ESC [ ? 5 h 1701 * XTERM_SEQ: Reverse video: ESC [ ? 5 h
1703 * XTERM_SEQ: Normal video : ESC [ ? 5 l 1702 * XTERM_SEQ: Normal video : ESC [ ? 5 l
1704 */ 1703 */
1705void 1704void
1706rxvt_term::scr_rvideo_mode (bool on) NOTHROW 1705rxvt_term::scr_rvideo_mode (bool on) noexcept
1707{ 1706{
1708 rvideo_mode = on; 1707 rvideo_mode = on;
1709 1708
1710#ifndef NO_BELL 1709#ifndef NO_BELL
1711 on ^= rvideo_bell; 1710 on ^= rvideo_bell;
1713 1712
1714 if (rvideo_state != on) 1713 if (rvideo_state != on)
1715 { 1714 {
1716 rvideo_state = on; 1715 rvideo_state = on;
1717 1716
1717#if OFF_FOCUS_FADING
1718 if (rs[Rs_fade])
1719 {
1720 ::swap (pix_colors_focused[Color_fg], pix_colors_focused[Color_bg]);
1721 ::swap (pix_colors_unfocused[Color_fg], pix_colors_unfocused[Color_bg]);
1722 }
1723 else
1724#endif
1718 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); 1725 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]);
1719#ifdef HAVE_IMG 1726#ifdef HAVE_IMG
1720 if (bg_img == 0) 1727 if (bg_img == 0)
1721#endif 1728#endif
1722 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); 1729 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
1735/* 1742/*
1736 * Report current cursor position 1743 * Report current cursor position
1737 * XTERM_SEQ: Report position: ESC [ 6 n 1744 * XTERM_SEQ: Report position: ESC [ 6 n
1738 */ 1745 */
1739void ecb_cold 1746void ecb_cold
1740rxvt_term::scr_report_position () NOTHROW 1747rxvt_term::scr_report_position () noexcept
1741{ 1748{
1742 tt_printf ("\033[%d;%dR", screen.cur.row + 1, screen.cur.col + 1); 1749 tt_printf ("\033[%d;%dR", screen.cur.row + 1, screen.cur.col + 1);
1743} 1750}
1744 1751
1745/* ------------------------------------------------------------------------- * 1752/* ------------------------------------------------------------------------- *
1748 1755
1749/* 1756/*
1750 * Set font style 1757 * Set font style
1751 */ 1758 */
1752void ecb_cold 1759void ecb_cold
1753rxvt_term::set_font_style () NOTHROW 1760rxvt_term::set_font_style () noexcept
1754{ 1761{
1755#if 0 1762#if 0
1756 switch (charsets [screen.charset]) 1763 switch (charsets [screen.charset])
1757 { 1764 {
1758 case '0': /* DEC Special Character & Line Drawing Set */ 1765 case '0': /* DEC Special Character & Line Drawing Set */
1780 * XTERM_SEQ: Invoke G1 character set: CTRL-N 1787 * XTERM_SEQ: Invoke G1 character set: CTRL-N
1781 * XTERM_SEQ: Invoke G2 character set: ESC N 1788 * XTERM_SEQ: Invoke G2 character set: ESC N
1782 * XTERM_SEQ: Invoke G3 character set: ESC O 1789 * XTERM_SEQ: Invoke G3 character set: ESC O
1783 */ 1790 */
1784void ecb_cold 1791void ecb_cold
1785rxvt_term::scr_charset_choose (int set) NOTHROW 1792rxvt_term::scr_charset_choose (int set) noexcept
1786{ 1793{
1787 screen.charset = set; 1794 screen.charset = set;
1788 set_font_style (); 1795 set_font_style ();
1789} 1796}
1790 1797
1796 * XTERM_SEQ: Set G2 character set: ESC * <C> 1803 * XTERM_SEQ: Set G2 character set: ESC * <C>
1797 * XTERM_SEQ: Set G3 character set: ESC + <C> 1804 * XTERM_SEQ: Set G3 character set: ESC + <C>
1798 * See set_font_style for possible values for <C> 1805 * See set_font_style for possible values for <C>
1799 */ 1806 */
1800void 1807void
1801rxvt_term::scr_charset_set (int set, unsigned int ch) NOTHROW 1808rxvt_term::scr_charset_set (int set, unsigned int ch) noexcept
1802{ 1809{
1803 charsets[set] = (unsigned char)ch; 1810 charsets[set] = (unsigned char)ch;
1804 set_font_style (); 1811 set_font_style ();
1805} 1812}
1806 1813
1811 1818
1812/* 1819/*
1813 * refresh matching text. 1820 * refresh matching text.
1814 */ 1821 */
1815bool ecb_cold 1822bool ecb_cold
1816rxvt_term::scr_refresh_rend (rend_t mask, rend_t value) NOTHROW 1823rxvt_term::scr_refresh_rend (rend_t mask, rend_t value) noexcept
1817{ 1824{
1818 bool found = false; 1825 bool found = false;
1819 1826
1820 for (int i = 0; i < nrow; i++) 1827 for (int i = 0; i < nrow; i++)
1821 { 1828 {
1840 PART_END, 1847 PART_END,
1841 RC_COUNT 1848 RC_COUNT
1842}; 1849};
1843 1850
1844void ecb_hot 1851void ecb_hot
1845rxvt_term::scr_expose (int x, int y, int ewidth, int eheight, bool refresh) NOTHROW 1852rxvt_term::scr_expose (int x, int y, int ewidth, int eheight, bool refresh) noexcept
1846{ 1853{
1847 int i; 1854 int i;
1848 row_col_t rc[RC_COUNT]; 1855 row_col_t rc[RC_COUNT];
1849 1856
1850 if (!drawn_buf) /* sanity check */ 1857 if (!drawn_buf) /* sanity check */
1884/* ------------------------------------------------------------------------- */ 1891/* ------------------------------------------------------------------------- */
1885/* 1892/*
1886 * Refresh the entire screen 1893 * Refresh the entire screen
1887 */ 1894 */
1888void 1895void
1889rxvt_term::scr_touch (bool refresh) NOTHROW 1896rxvt_term::scr_touch (bool refresh) noexcept
1890{ 1897{
1891 scr_expose (0, 0, vt_width, vt_height, refresh); 1898 scr_expose (0, 0, vt_width, vt_height, refresh);
1892} 1899}
1893 1900
1894/* ------------------------------------------------------------------------- */ 1901/* ------------------------------------------------------------------------- */
1895/* 1902/*
1896 * Move the display so that the line represented by scrollbar value Y is at 1903 * Move the display so that the line represented by scrollbar value Y is at
1897 * the top of the screen 1904 * the top of the screen
1898 */ 1905 */
1899void 1906void
1900rxvt_term::scr_move_to (int y, int len) NOTHROW 1907rxvt_term::scr_move_to (int y, int len) noexcept
1901{ 1908{
1902 // lerp (y, 0, len, top_row, nrow - 1) 1909 // lerp (y, 0, len, top_row, nrow - 1)
1903 scr_changeview (top_row + (nrow - 1 - top_row) * y / len); 1910 scr_changeview (top_row + (nrow - 1 - top_row) * y / len);
1904} 1911}
1905 1912
1907/* 1914/*
1908 * Page the screen up/down nlines 1915 * Page the screen up/down nlines
1909 * direction should be UP or DN 1916 * direction should be UP or DN
1910 */ 1917 */
1911bool 1918bool
1912rxvt_term::scr_page (int nlines) NOTHROW 1919rxvt_term::scr_page (int nlines) noexcept
1913{ 1920{
1914 return scr_changeview (view_start - nlines); 1921 return scr_changeview (view_start - nlines);
1915} 1922}
1916 1923
1917bool 1924bool
1918rxvt_term::scr_changeview (int new_view_start) NOTHROW 1925rxvt_term::scr_changeview (int new_view_start) noexcept
1919{ 1926{
1920 clamp_it (new_view_start, top_row, 0); 1927 clamp_it (new_view_start, top_row, 0);
1921 1928
1922 if (new_view_start == view_start) 1929 if (new_view_start == view_start)
1923 return false; 1930 return false;
1941} 1948}
1942#endif 1949#endif
1943 1950
1944/* ------------------------------------------------------------------------- */ 1951/* ------------------------------------------------------------------------- */
1945void 1952void
1946rxvt_term::scr_bell () NOTHROW 1953rxvt_term::scr_bell () noexcept
1947{ 1954{
1948#ifndef NO_BELL 1955#ifndef NO_BELL
1949 1956
1950# ifndef NO_MAPALERT 1957# ifndef NO_MAPALERT
1951# ifdef MAPALERT_OPTION 1958# ifdef MAPALERT_OPTION
1973#endif 1980#endif
1974} 1981}
1975 1982
1976/* ------------------------------------------------------------------------- */ 1983/* ------------------------------------------------------------------------- */
1977void ecb_cold 1984void ecb_cold
1978rxvt_term::scr_printscreen (int fullhist) NOTHROW 1985rxvt_term::scr_printscreen (int fullhist) noexcept
1979{ 1986{
1980#ifdef PRINTPIPE 1987#ifdef PRINTPIPE
1981 int nrows, row_start; 1988 int nrows, row_start;
1982 FILE *fd = popen_printer (); 1989 FILE *fd = popen_printer ();
1983 1990
2032 * Refresh the screen 2039 * Refresh the screen
2033 * drawn_text/drawn_rend contain the screen information before the update. 2040 * drawn_text/drawn_rend contain the screen information before the update.
2034 * screen.text/screen.rend contain what the screen will change to. 2041 * screen.text/screen.rend contain what the screen will change to.
2035 */ 2042 */
2036void ecb_hot 2043void ecb_hot
2037rxvt_term::scr_refresh () NOTHROW 2044rxvt_term::scr_refresh () noexcept
2038{ 2045{
2039 int16_t col, row, /* column/row we're processing */ 2046 int16_t col, row, /* column/row we're processing */
2040 ocrow; /* old cursor row */ 2047 ocrow; /* old cursor row */
2041 int i; /* tmp */ 2048 int i; /* tmp */
2042 rend_t ccol1, /* Cursor colour */ 2049 rend_t ccol1, /* Cursor colour */
2489 num_scr = 0; 2496 num_scr = 0;
2490 num_scr_allow = 1; 2497 num_scr_allow = 1;
2491} 2498}
2492 2499
2493void ecb_cold 2500void ecb_cold
2494rxvt_term::scr_remap_chars (line_t &l) NOTHROW 2501rxvt_term::scr_remap_chars (line_t &l) noexcept
2495{ 2502{
2496 if (!l.valid ()) 2503 if (!l.valid ())
2497 return; 2504 return;
2498 2505
2499 l.touch (); // maybe a bit of an overkill, but it's not performance-relevant 2506 l.touch (); // maybe a bit of an overkill, but it's not performance-relevant
2501 for (int i = ncol; i--; ) 2508 for (int i = ncol; i--; )
2502 l.r[i] = SET_FONT (l.r[i], FONTSET (l.r[i])->find_font (l.t[i])); 2509 l.r[i] = SET_FONT (l.r[i], FONTSET (l.r[i])->find_font (l.t[i]));
2503} 2510}
2504 2511
2505void ecb_cold 2512void ecb_cold
2506rxvt_term::scr_remap_chars () NOTHROW 2513rxvt_term::scr_remap_chars () noexcept
2507{ 2514{
2508 for (int i = total_rows; i--; ) 2515 for (int i = total_rows; i--; )
2509 scr_remap_chars (row_buf [i]); 2516 scr_remap_chars (row_buf [i]);
2510 2517
2511 for (int i = nrow; i--; ) 2518 for (int i = nrow; i--; )
2514 scr_remap_chars (swap_buf [i]); 2521 scr_remap_chars (swap_buf [i]);
2515 } 2522 }
2516} 2523}
2517 2524
2518void ecb_cold 2525void ecb_cold
2519rxvt_term::scr_recolor (bool refresh) NOTHROW 2526rxvt_term::scr_recolor (bool refresh) noexcept
2520{ 2527{
2521 bool transparent = false; 2528 bool transparent = false;
2522 2529
2523#ifdef HAVE_IMG 2530#ifdef HAVE_IMG
2524 if (bg_img != 0) 2531 if (bg_img != 0)
2565 want_refresh = 1; 2572 want_refresh = 1;
2566} 2573}
2567 2574
2568/* ------------------------------------------------------------------------- */ 2575/* ------------------------------------------------------------------------- */
2569void 2576void
2570rxvt_term::scr_clear (bool really) NOTHROW 2577rxvt_term::scr_clear (bool really) noexcept
2571{ 2578{
2572 if (!mapped) 2579 if (!mapped)
2573 return; 2580 return;
2574 2581
2575 num_scr_allow = 0; 2582 num_scr_allow = 0;
2578 if (really) 2585 if (really)
2579 XClearWindow (dpy, vt); 2586 XClearWindow (dpy, vt);
2580} 2587}
2581 2588
2582void 2589void
2583rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle1, rend_t rstyle2) NOTHROW 2590rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle1, rend_t rstyle2) noexcept
2584{ 2591{
2585 int view_end = view_start + nrow; 2592 int view_end = view_start + nrow;
2586 int row, col; 2593 int row, col;
2587 2594
2588 for (row = max (beg_row, view_start); row <= min (end_row, view_end); row++) 2595 for (row = max (beg_row, view_start); row <= min (end_row, view_end); row++)
2600 srp[col] ^= rstyle2; 2607 srp[col] ^= rstyle2;
2601 } 2608 }
2602} 2609}
2603 2610
2604void 2611void
2605rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle) NOTHROW 2612rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle) noexcept
2606{ 2613{
2607 int view_end = view_start + nrow; 2614 int view_end = view_start + nrow;
2608 int row, col; 2615 int row, col;
2609 2616
2610 if (beg_row >= view_start) 2617 if (beg_row >= view_start)
2627 srp[col] ^= rstyle; 2634 srp[col] ^= rstyle;
2628} 2635}
2629 2636
2630/* ------------------------------------------------------------------------- */ 2637/* ------------------------------------------------------------------------- */
2631void ecb_hot 2638void ecb_hot
2632rxvt_term::scr_reverse_selection () NOTHROW 2639rxvt_term::scr_reverse_selection () noexcept
2633{ 2640{
2634 if (selection.op 2641 if (selection.op
2635 && current_screen == selection.screen 2642 && current_screen == selection.screen
2636 && selection.end.row >= view_start) 2643 && selection.end.row >= view_start)
2637 { 2644 {
2653 * Dump the whole scrollback and screen to the passed filedescriptor. The 2660 * Dump the whole scrollback and screen to the passed filedescriptor. The
2654 * invoking routine must close the fd. 2661 * invoking routine must close the fd.
2655 */ 2662 */
2656#if 0 2663#if 0
2657void 2664void
2658rxvt_term::scr_dump (int fd) NOTHROW 2665rxvt_term::scr_dump (int fd) noexcept
2659{ 2666{
2660 // if this method is needed, it can be implemented by factoring the 2667 // if this method is needed, it can be implemented by factoring the
2661 // relevant code in scr_printscreen 2668 // relevant code in scr_printscreen
2662} 2669}
2663#endif 2670#endif
2664 2671
2665/* ------------------------------------------------------------------------- * 2672/* ------------------------------------------------------------------------- *
2666 * CHARACTER SELECTION * 2673 * CHARACTER SELECTION *
2667 * ------------------------------------------------------------------------- */ 2674 * ------------------------------------------------------------------------- */
2668void 2675void
2669rxvt_term::selection_check (int check_more) NOTHROW 2676rxvt_term::selection_check (int check_more) noexcept
2670{ 2677{
2671 if (!selection.op) 2678 if (!selection.op)
2672 return; 2679 return;
2673 2680
2674 if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) 2681 if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow)
2680 && ROWCOL_IS_BEFORE (screen.cur, selection.end))) 2687 && ROWCOL_IS_BEFORE (screen.cur, selection.end)))
2681 CLEAR_ALL_SELECTION (); 2688 CLEAR_ALL_SELECTION ();
2682} 2689}
2683 2690
2684void 2691void
2685rxvt_term::selection_changed () NOTHROW 2692rxvt_term::selection_changed () noexcept
2686{ 2693{
2687 line_t &r1 = ROW (selection.beg.row); 2694 line_t &r1 = ROW (selection.beg.row);
2688 while (selection.beg.col < r1.l && r1.t [selection.beg.col] == NOCHAR) 2695 while (selection.beg.col < r1.l && r1.t [selection.beg.col] == NOCHAR)
2689 ++selection.beg.col; 2696 ++selection.beg.col;
2690 2697
2698/* ------------------------------------------------------------------------- */ 2705/* ------------------------------------------------------------------------- */
2699/* 2706/*
2700 * Paste a selection direct to the command fd 2707 * Paste a selection direct to the command fd
2701 */ 2708 */
2702void 2709void
2703rxvt_term::tt_paste (char *data, unsigned int len) NOTHROW 2710rxvt_term::tt_paste (char *data, unsigned int len) noexcept
2704{ 2711{
2705 /* convert normal newline chars into common keyboard Return key sequence */ 2712 /* convert normal newline chars into common keyboard Return key sequence */
2706 for (unsigned int i = 0; i < len; i++) 2713 for (unsigned int i = 0; i < len; i++)
2707 if (data[i] == C0_LF) 2714 if (data[i] == C0_LF)
2708 data[i] = C0_CR; 2715 data[i] = C0_CR;
2709 2716
2710 if (priv_modes & PrivMode_BracketPaste) 2717 #if ENABLE_FRILLS
2718 if ((priv_modes & PrivMode_BracketPaste) && !option (Opt_disablePasteBrackets))
2711 tt_printf ("\x1b[200~"); 2719 tt_printf ("\x1b[200~");
2720 #endif
2712 2721
2713 tt_write (data, len); 2722 tt_write (data, len);
2714 2723
2715 if (priv_modes & PrivMode_BracketPaste) 2724 #if ENABLE_FRILLS
2725 if ((priv_modes & PrivMode_BracketPaste) && !option (Opt_disablePasteBrackets))
2716 tt_printf ("\x1b[201~"); 2726 tt_printf ("\x1b[201~");
2727 #endif
2717} 2728}
2718 2729
2719void 2730void
2720rxvt_term::paste (char *data, unsigned int len) NOTHROW 2731rxvt_term::paste (char *data, unsigned int len) noexcept
2721{ 2732{
2722 if (HOOK_INVOKE ((this, HOOK_TT_PASTE, DT_STR_LEN, data, len, DT_END))) 2733 if (HOOK_INVOKE ((this, HOOK_TT_PASTE, DT_STR_LEN, data, len, DT_END)))
2723 return; 2734 return;
2724 2735
2725 tt_paste (data, len); 2736 tt_paste (data, len);
2731 * if the requested selection has no owner or is empty CUT_BUFFER0 is used 2742 * if the requested selection has no owner or is empty CUT_BUFFER0 is used
2732 * as fallback 2743 * as fallback
2733 * EXT: button 2 release 2744 * EXT: button 2 release
2734 */ 2745 */
2735void 2746void
2736rxvt_term::selection_request (Time tm, int selnum) NOTHROW 2747rxvt_term::selection_request (Time tm, int selnum) noexcept
2737{ 2748{
2738 if (!selection_req) 2749 if (!selection_req)
2739 { 2750 {
2740 selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this); 2751 selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this);
2741 selection_req->run (); 2752 selection_req->run ();
2746/* 2757/*
2747 * Clear all selected text 2758 * Clear all selected text
2748 * EXT: SelectionClear 2759 * EXT: SelectionClear
2749 */ 2760 */
2750void 2761void
2751rxvt_term::selection_clear (bool clipboard) NOTHROW 2762rxvt_term::selection_clear (bool clipboard) noexcept
2752{ 2763{
2753 if (!clipboard) 2764 if (!clipboard)
2754 { 2765 {
2755 want_refresh = 1; 2766 want_refresh = 1;
2756 free (selection.text); 2767 free (selection.text);
2841 if (*t == NOCHAR) 2852 if (*t == NOCHAR)
2842 t++; 2853 t++;
2843#if ENABLE_COMBINING 2854#if ENABLE_COMBINING
2844 else if (IS_COMPOSE (*t)) 2855 else if (IS_COMPOSE (*t))
2845 { 2856 {
2846 int len = rxvt_composite.expand (*t, 0); 2857 int len = rxvt_composite.expand (*t);
2847 2858
2848 extra -= (len - 1); 2859 extra -= (len - 1);
2849 2860
2850 if (extra < 0) 2861 if (extra < 0)
2851 { 2862 {
2898 2909
2899 selection_grab (tm); 2910 selection_grab (tm);
2900} 2911}
2901 2912
2902bool 2913bool
2903rxvt_term::selection_grab (Time tm, bool clipboard) NOTHROW 2914rxvt_term::selection_grab (Time tm, bool clipboard) noexcept
2904{ 2915{
2905 Atom sel; 2916 Atom sel;
2906 2917
2907 if (!clipboard) 2918 if (!clipboard)
2908 { 2919 {
2942/* 2953/*
2943 * Mark or select text based upon number of clicks: 1, 2, or 3 2954 * Mark or select text based upon number of clicks: 1, 2, or 3
2944 * EXT: button 1 press 2955 * EXT: button 1 press
2945 */ 2956 */
2946void ecb_cold 2957void ecb_cold
2947rxvt_term::selection_click (int clicks, int x, int y) NOTHROW 2958rxvt_term::selection_click (int clicks, int x, int y) noexcept
2948{ 2959{
2949 clicks = ((clicks - 1) % 3) + 1; 2960 clicks = ((clicks - 1) % 3) + 1;
2950 selection.clicks = clicks; /* save clicks so extend will work */ 2961 selection.clicks = clicks; /* save clicks so extend will work */
2951 2962
2952 if (clicks == 2 && !selection.rect 2963 if (clicks == 2 && !selection.rect
2971/* ------------------------------------------------------------------------- */ 2982/* ------------------------------------------------------------------------- */
2972/* 2983/*
2973 * Mark a selection at the specified col/row 2984 * Mark a selection at the specified col/row
2974 */ 2985 */
2975void ecb_cold 2986void ecb_cold
2976rxvt_term::selection_start_colrow (int col, int row) NOTHROW 2987rxvt_term::selection_start_colrow (int col, int row) noexcept
2977{ 2988{
2978 want_refresh = 1; 2989 want_refresh = 1;
2979 2990
2980 selection.mark.row = row + view_start; 2991 selection.mark.row = row + view_start;
2981 selection.mark.col = col; 2992 selection.mark.col = col;
3008#define DELIMIT_TEXT(x) \ 3019#define DELIMIT_TEXT(x) \
3009 (unicode::is_space (x) ? 2 : (x) <= 0xff && !!strchr (rs[Rs_cutchars], (x))) 3020 (unicode::is_space (x) ? 2 : (x) <= 0xff && !!strchr (rs[Rs_cutchars], (x)))
3010#define DELIMIT_REND(x) 1 3021#define DELIMIT_REND(x) 1
3011 3022
3012void ecb_cold 3023void ecb_cold
3013rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) NOTHROW 3024rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) noexcept
3014{ 3025{
3015 int col, row, dirnadd, tcol, trow, w1, w2; 3026 int col, row, dirnadd, tcol, trow, w1, w2;
3016 row_col_t bound; 3027 row_col_t bound;
3017 text_t *stp; 3028 text_t *stp;
3018 rend_t *srp; 3029 rend_t *srp;
3092 * flag == 0 ==> button 1 3103 * flag == 0 ==> button 1
3093 * flag == 1 ==> button 3 press 3104 * flag == 1 ==> button 3 press
3094 * flag == 2 ==> button 3 motion 3105 * flag == 2 ==> button 3 motion
3095 */ 3106 */
3096void ecb_cold 3107void ecb_cold
3097rxvt_term::selection_extend (int x, int y, int flag) NOTHROW 3108rxvt_term::selection_extend (int x, int y, int flag) noexcept
3098{ 3109{
3099 int col = clamp (Pixel2Col (x), 0, ncol); 3110 int col = clamp (Pixel2Col (x), 0, ncol);
3100 int row = clamp (Pixel2Row (y), 0, nrow - 1); 3111 int row = clamp (Pixel2Row (y), 0, nrow - 1);
3101 3112
3102 /* 3113 /*
3128/* ------------------------------------------------------------------------- */ 3139/* ------------------------------------------------------------------------- */
3129/* 3140/*
3130 * Extend the selection to the specified col/row 3141 * Extend the selection to the specified col/row
3131 */ 3142 */
3132void ecb_cold 3143void ecb_cold
3133rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) NOTHROW 3144rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) noexcept
3134{ 3145{
3135 row_col_t pos; 3146 row_col_t pos;
3136 enum { 3147 enum {
3137 LEFT, RIGHT 3148 LEFT, RIGHT
3138 } closeto = RIGHT; 3149 } closeto = RIGHT;
3329 selection_changed (); 3340 selection_changed ();
3330} 3341}
3331 3342
3332#if !ENABLE_MINIMAL 3343#if !ENABLE_MINIMAL
3333void ecb_cold 3344void ecb_cold
3334rxvt_term::selection_remove_trailing_spaces () NOTHROW 3345rxvt_term::selection_remove_trailing_spaces () noexcept
3335{ 3346{
3336 int32_t end_col, end_row; 3347 int32_t end_col, end_row;
3337 text_t *stp; 3348 text_t *stp;
3338 3349
3339 end_col = selection.end.col; 3350 end_col = selection.end.col;
3377/* 3388/*
3378 * Double click on button 3 when already selected 3389 * Double click on button 3 when already selected
3379 * EXT: button 3 double click 3390 * EXT: button 3 double click
3380 */ 3391 */
3381void ecb_cold 3392void ecb_cold
3382rxvt_term::selection_rotate (int x, int y) NOTHROW 3393rxvt_term::selection_rotate (int x, int y) noexcept
3383{ 3394{
3384 selection.clicks = selection.clicks % 3 + 1; 3395 selection.clicks = selection.clicks % 3 + 1;
3385 selection_extend_colrow (Pixel2Col (x), Pixel2Row (y), 1, 0, 1); 3396 selection_extend_colrow (Pixel2Col (x), Pixel2Row (y), 1, 0, 1);
3386} 3397}
3387 3398
3389/* 3400/*
3390 * Respond to a request for our current selection 3401 * Respond to a request for our current selection
3391 * EXT: SelectionRequest 3402 * EXT: SelectionRequest
3392 */ 3403 */
3393void ecb_cold 3404void ecb_cold
3394rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW 3405rxvt_term::selection_send (const XSelectionRequestEvent &rq) noexcept
3395{ 3406{
3396 Atom property = rq.property == None ? rq.target : rq.property; 3407 Atom property = rq.property == None ? rq.target : rq.property;
3397 XSelectionEvent ev; 3408 XSelectionEvent ev;
3398 3409
3399 ev.type = SelectionNotify; 3410 ev.type = SelectionNotify;
3491 cl = selection.clip_text; 3502 cl = selection.clip_text;
3492 selectlen = selection.clip_len; 3503 selectlen = selection.clip_len;
3493 } 3504 }
3494 else 3505 else
3495 { 3506 {
3496 cl = L""; 3507 cl = (wchar_t *)L"";
3497 selectlen = 0; 3508 selectlen = 0;
3498 } 3509 }
3499 3510
3500#if !ENABLE_MINIMAL 3511#if !ENABLE_MINIMAL
3501 // xlib is horribly broken with respect to UTF8_STRING, and nobody cares to fix it 3512 // xlib is horribly broken with respect to UTF8_STRING, and nobody cares to fix it
3533} 3544}
3534 3545
3535/* ------------------------------------------------------------------------- */ 3546/* ------------------------------------------------------------------------- */
3536#if USE_XIM 3547#if USE_XIM
3537void ecb_cold 3548void ecb_cold
3538rxvt_term::im_set_position (XPoint &pos) NOTHROW 3549rxvt_term::im_set_position (XPoint &pos) noexcept
3539{ 3550{
3540 XWindowAttributes xwa; 3551 XWindowAttributes xwa;
3541 3552
3542 XGetWindowAttributes (dpy, vt, &xwa); 3553 XGetWindowAttributes (dpy, vt, &xwa);
3543 3554
3546} 3557}
3547#endif 3558#endif
3548 3559
3549#if ENABLE_OVERLAY 3560#if ENABLE_OVERLAY
3550void 3561void
3551rxvt_term::scr_overlay_new (int x, int y, int w, int h) NOTHROW 3562rxvt_term::scr_overlay_new (int x, int y, int w, int h) noexcept
3552{ 3563{
3553 if (nrow < 1 || ncol < 1) 3564 if (nrow < 1 || ncol < 1)
3554 return; 3565 return;
3555 3566
3556 want_refresh = 1; 3567 want_refresh = 1;
3601 *rp = r; 3612 *rp = r;
3602 } 3613 }
3603} 3614}
3604 3615
3605void 3616void
3606rxvt_term::scr_overlay_off () NOTHROW 3617rxvt_term::scr_overlay_off () noexcept
3607{ 3618{
3608 if (!ov.text) 3619 if (!ov.text)
3609 return; 3620 return;
3610 3621
3611 want_refresh = 1; 3622 want_refresh = 1;
3619 delete [] ov.text; ov.text = 0; 3630 delete [] ov.text; ov.text = 0;
3620 delete [] ov.rend; ov.rend = 0; 3631 delete [] ov.rend; ov.rend = 0;
3621} 3632}
3622 3633
3623void 3634void
3624rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW 3635rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) noexcept
3625{ 3636{
3626 if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2) 3637 if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2)
3627 return; 3638 return;
3628 3639
3629 x++, y++; 3640 x++, y++;
3631 ov.text[y][x] = text; 3642 ov.text[y][x] = text;
3632 ov.rend[y][x] = rend; 3643 ov.rend[y][x] = rend;
3633} 3644}
3634 3645
3635void 3646void
3636rxvt_term::scr_overlay_set (int x, int y, const char *s) NOTHROW 3647rxvt_term::scr_overlay_set (int x, int y, const char *s) noexcept
3637{ 3648{
3638 while (*s) 3649 while (*s)
3639 scr_overlay_set (x++, y, *s++); 3650 scr_overlay_set (x++, y, *s++);
3640} 3651}
3641 3652
3642void 3653void
3643rxvt_term::scr_overlay_set (int x, int y, const wchar_t *s) NOTHROW 3654rxvt_term::scr_overlay_set (int x, int y, const wchar_t *s) noexcept
3644{ 3655{
3645 while (*s) 3656 while (*s)
3646 { 3657 {
3647 text_t t = *s++; 3658 text_t t = *s++;
3648 int width = WCWIDTH (t); 3659 int width = WCWIDTH (t);
3654 } 3665 }
3655 } 3666 }
3656} 3667}
3657 3668
3658void 3669void
3659rxvt_term::scr_swap_overlay () NOTHROW 3670rxvt_term::scr_swap_overlay () noexcept
3660{ 3671{
3661 if (!ov.text) 3672 if (!ov.text)
3662 return; 3673 return;
3663 3674
3664 // hide cursor if it is within the overlay area 3675 // hide cursor if it is within the overlay area

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines