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