1 | /*--------------------------------*-C-*--------------------------------------* |
1 | /*--------------------------------*-C-*--------------------------------------* |
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-2004 Marc Lehmann <pcg@goof.com> |
6 | * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> |
7 | * |
7 | * |
… | |
… | |
29 | #include "rxvt.h" /* NECESSARY */ |
29 | #include "rxvt.h" /* NECESSARY */ |
30 | #include "screen.intpro" /* PROTOS for internal routines */ |
30 | #include "screen.intpro" /* PROTOS for internal routines */ |
31 | |
31 | |
32 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
32 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
33 | |
33 | |
34 | #include <stdint.h> |
34 | #include <inttypes.h> |
35 | #include <wchar.h> |
35 | #include <wchar.h> |
36 | |
36 | |
37 | #include "salloc.C" // HACK, should be a seperate compile! |
37 | #include "salloc.C" // HACK, should be a seperate compile! |
38 | |
38 | |
39 | inline void fill_text (text_t *start, text_t value, int len) |
39 | inline void fill_text (text_t *start, text_t value, int len) |
… | |
… | |
48 | |
48 | |
49 | /* ------------------------------------------------------------------------- * |
49 | /* ------------------------------------------------------------------------- * |
50 | * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * |
50 | * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * |
51 | * ------------------------------------------------------------------------- */ |
51 | * ------------------------------------------------------------------------- */ |
52 | #define ZERO_SCROLLBACK() \ |
52 | #define ZERO_SCROLLBACK() \ |
53 | if ((Options & Opt_scrollTtyOutput) == Opt_scrollTtyOutput) \ |
53 | if (Options & Opt_scrollTtyOutput) \ |
54 | TermWin.view_start = 0 |
54 | TermWin.view_start = 0 |
55 | #define CLEAR_SELECTION() \ |
55 | #define CLEAR_SELECTION() \ |
56 | selection.beg.row = selection.beg.col \ |
56 | selection.beg.row = selection.beg.col \ |
57 | = selection.end.row = selection.end.col = 0 |
57 | = selection.end.row = selection.end.col = 0 |
58 | #define CLEAR_ALL_SELECTION() \ |
58 | #define CLEAR_ALL_SELECTION() \ |
59 | selection.beg.row = selection.beg.col \ |
59 | selection.beg.row = selection.beg.col \ |
60 | = selection.mark.row = selection.mark.col \ |
60 | = selection.mark.row = selection.mark.col \ |
61 | = selection.end.row = selection.end.col = 0 |
61 | = selection.end.row = selection.end.col = 0 |
62 | |
62 | |
63 | #define ROW_AND_COL_IS_AFTER(A, B, C, D) \ |
63 | #define ROW_AND_COL_IS_AFTER(A, B, C, D) \ |
64 | (((A) > (C)) || (((A) == (C)) && ((B) > (D)))) |
64 | (((A) > (C)) || (((A) == (C)) && ((B) > (D)))) |
65 | #define ROW_AND_COL_IS_BEFORE(A, B, C, D) \ |
65 | #define ROW_AND_COL_IS_BEFORE(A, B, C, D) \ |
66 | (((A) < (C)) || (((A) == (C)) && ((B) < (D)))) |
66 | (((A) < (C)) || (((A) == (C)) && ((B) < (D)))) |
67 | #define ROW_AND_COL_IN_ROW_AFTER(A, B, C, D) \ |
67 | #define ROW_AND_COL_IN_ROW_AFTER(A, B, C, D) \ |
68 | (((A) == (C)) && ((B) > (D))) |
68 | (((A) == (C)) && ((B) > (D))) |
69 | #define ROW_AND_COL_IN_ROW_AT_OR_AFTER(A, B, C, D) \ |
69 | #define ROW_AND_COL_IN_ROW_AT_OR_AFTER(A, B, C, D) \ |
70 | (((A) == (C)) && ((B) >= (D))) |
70 | (((A) == (C)) && ((B) >= (D))) |
71 | #define ROW_AND_COL_IN_ROW_BEFORE(A, B, C, D) \ |
71 | #define ROW_AND_COL_IN_ROW_BEFORE(A, B, C, D) \ |
72 | (((A) == (C)) && ((B) < (D))) |
72 | (((A) == (C)) && ((B) < (D))) |
73 | #define ROW_AND_COL_IN_ROW_AT_OR_BEFORE(A, B, C, D) \ |
73 | #define ROW_AND_COL_IN_ROW_AT_OR_BEFORE(A, B, C, D) \ |
74 | (((A) == (C)) && ((B) <= (D))) |
74 | (((A) == (C)) && ((B) <= (D))) |
75 | |
75 | |
76 | /* these must be row_col_t */ |
76 | /* these must be row_col_t */ |
77 | #define ROWCOL_IS_AFTER(X, Y) \ |
77 | #define ROWCOL_IS_AFTER(X, Y) \ |
78 | ROW_AND_COL_IS_AFTER ((X).row, (X).col, (Y).row, (Y).col) |
78 | ROW_AND_COL_IS_AFTER ((X).row, (X).col, (Y).row, (Y).col) |
79 | #define ROWCOL_IS_BEFORE(X, Y) \ |
79 | #define ROWCOL_IS_BEFORE(X, Y) \ |
80 | ROW_AND_COL_IS_BEFORE ((X).row, (X).col, (Y).row, (Y).col) |
80 | ROW_AND_COL_IS_BEFORE ((X).row, (X).col, (Y).row, (Y).col) |
81 | #define ROWCOL_IN_ROW_AFTER(X, Y) \ |
81 | #define ROWCOL_IN_ROW_AFTER(X, Y) \ |
82 | ROW_AND_COL_IN_ROW_AFTER ((X).row, (X).col, (Y).row, (Y).col) |
82 | ROW_AND_COL_IN_ROW_AFTER ((X).row, (X).col, (Y).row, (Y).col) |
83 | #define ROWCOL_IN_ROW_BEFORE(X, Y) \ |
83 | #define ROWCOL_IN_ROW_BEFORE(X, Y) \ |
84 | ROW_AND_COL_IN_ROW_BEFORE ((X).row, (X).col, (Y).row, (Y).col) |
84 | ROW_AND_COL_IN_ROW_BEFORE ((X).row, (X).col, (Y).row, (Y).col) |
85 | #define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \ |
85 | #define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \ |
86 | ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) |
86 | ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) |
87 | #define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ |
87 | #define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ |
88 | ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) |
88 | ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) |
89 | |
89 | |
90 | /* |
90 | /* |
91 | * CLEAR_ROWS : clear <num> rows starting from row <row> |
91 | * CLEAR_ROWS : clear <num> rows starting from row <row> |
92 | * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y> |
92 | * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y> |
93 | * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour |
93 | * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour |
94 | */ |
94 | */ |
95 | #define drawBuffer TermWin.vt |
95 | #define drawBuffer TermWin.vt |
96 | |
96 | |
97 | #define CLEAR_ROWS(row, num) \ |
97 | #define CLEAR_ROWS(row, num) \ |
98 | if (TermWin.mapped) \ |
98 | if (TermWin.mapped) \ |
99 | XClearArea (display->display, drawBuffer, TermWin.int_bwidth, \ |
99 | XClearArea (display->display, drawBuffer, 0, \ |
100 | Row2Pixel (row), (unsigned int)TermWin.width, \ |
100 | Row2Pixel (row), (unsigned int)TermWin.width, \ |
101 | (unsigned int)Height2Pixel (num), False) |
101 | (unsigned int)Height2Pixel (num), False) |
102 | |
102 | |
103 | #define CLEAR_CHARS(x, y, num) \ |
103 | #define CLEAR_CHARS(x, y, num) \ |
104 | if (TermWin.mapped) \ |
104 | if (TermWin.mapped) \ |
105 | XClearArea (display->display, drawBuffer, x, y, \ |
105 | XClearArea (display->display, drawBuffer, x, y, \ |
106 | (unsigned int)Width2Pixel (num), \ |
106 | (unsigned int)Width2Pixel (num), \ |
107 | (unsigned int)Height2Pixel (1), False) |
107 | (unsigned int)Height2Pixel (1), False) |
108 | |
108 | |
109 | #define ERASE_ROWS(row, num) \ |
109 | #define ERASE_ROWS(row, num) \ |
110 | XFillRectangle (display->display, drawBuffer, TermWin.gc, \ |
110 | XFillRectangle (display->display, drawBuffer, TermWin.gc, \ |
111 | TermWin.int_bwidth, Row2Pixel (row), \ |
111 | 0, Row2Pixel (row), \ |
112 | (unsigned int)TermWin.width, \ |
112 | (unsigned int)TermWin.width, \ |
113 | (unsigned int)Height2Pixel (num)) |
113 | (unsigned int)Height2Pixel (num)) |
114 | |
114 | |
115 | /* ------------------------------------------------------------------------- * |
115 | /* ------------------------------------------------------------------------- * |
116 | * SCREEN `COMMON' ROUTINES * |
116 | * SCREEN `COMMON' ROUTINES * |
117 | * ------------------------------------------------------------------------- */ |
117 | * ------------------------------------------------------------------------- */ |
118 | /* Fill part/all of a line with blanks. */ |
118 | /* Fill part/all of a line with blanks. */ |
119 | void |
119 | void |
120 | rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs) |
120 | rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs) |
121 | { |
121 | { |
122 | efs &= ~RS_baseattrMask; |
122 | efs &= ~RS_baseattrMask; |
123 | efs = SET_FONT (efs, TermWin.fontset->find_font (' ')); |
123 | efs = SET_FONT (efs, TermWin.ascii_map [' ' - 0x20]); |
124 | |
124 | |
125 | while (width--) |
125 | while (width--) |
126 | { |
126 | { |
127 | *et++ = ' '; |
127 | *et++ = ' '; |
128 | *er++ = efs; |
128 | *er++ = efs; |
… | |
… | |
189 | } |
189 | } |
190 | |
190 | |
191 | if (prev_nrow == 0) |
191 | if (prev_nrow == 0) |
192 | { |
192 | { |
193 | /* |
193 | /* |
194 | * first time called so just malloc everything : don't rely on realloc |
194 | * first time called so just malloc everything: don't rely on realloc |
195 | * Note: this is still needed so that all the scrollback lines are NULL |
195 | * Note: this is still needed so that all the scrollback lines are NULL |
196 | */ |
196 | */ |
197 | screen.text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); |
197 | screen.text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); |
198 | buf_text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); |
198 | buf_text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); |
199 | drawn_text = (text_t **)rxvt_calloc (nrow, sizeof (text_t *)); |
199 | drawn_text = (text_t **)rxvt_calloc (nrow, sizeof (text_t *)); |
… | |
… | |
256 | scr_scroll_text (0, (int)prev_nrow - 1, k, 1); |
256 | scr_scroll_text (0, (int)prev_nrow - 1, k, 1); |
257 | |
257 | |
258 | for (p = nrow; p < prev_nrow; p++) |
258 | for (p = nrow; p < prev_nrow; p++) |
259 | { |
259 | { |
260 | q = p + TermWin.saveLines; |
260 | q = p + TermWin.saveLines; |
|
|
261 | |
261 | if (screen.text[q]) |
262 | if (screen.text[q]) |
262 | { |
263 | { |
263 | #ifdef DEBUG_STRICT |
264 | #ifdef DEBUG_STRICT |
264 | assert (screen.rend[q]); |
265 | assert (screen.rend[q]); |
265 | #endif |
266 | #endif |
266 | talloc->free (screen.text[q]); |
267 | talloc->free (screen.text[q]); |
267 | ralloc->free (screen.rend[q]); |
268 | ralloc->free (screen.rend[q]); |
268 | } |
269 | } |
|
|
270 | |
269 | if (swap.text[p]) |
271 | if (swap.text[p]) |
270 | { |
272 | { |
271 | #ifdef DEBUG_STRICT |
273 | #ifdef DEBUG_STRICT |
272 | assert (swap.rend[p]); |
274 | assert (swap.rend[p]); |
273 | #endif |
275 | #endif |
274 | talloc->free (swap.text[p]); |
276 | talloc->free (swap.text[p]); |
275 | ralloc->free (swap.rend[p]); |
277 | ralloc->free (swap.rend[p]); |
276 | } |
278 | } |
|
|
279 | |
277 | #ifdef DEBUG_STRICT |
280 | #ifdef DEBUG_STRICT |
278 | assert (drawn_text[p] && drawn_rend[p]); |
281 | assert (drawn_text[p] && drawn_rend[p]); |
279 | #endif |
282 | #endif |
280 | talloc->free (drawn_text[p]); |
283 | talloc->free (drawn_text[p]); |
281 | ralloc->free (drawn_rend[p]); |
284 | ralloc->free (drawn_rend[p]); |
… | |
… | |
311 | swap.tlen[p] = 0; |
314 | swap.tlen[p] = 0; |
312 | swap.text[p] = NULL; |
315 | swap.text[p] = NULL; |
313 | swap.rend[p] = NULL; |
316 | swap.rend[p] = NULL; |
314 | drawn_text[p] = NULL; |
317 | drawn_text[p] = NULL; |
315 | drawn_rend[p] = NULL; |
318 | drawn_rend[p] = NULL; |
316 | scr_blank_screen_mem (swap.text, swap.rend, p, setrstyle); |
319 | scr_blank_screen_mem (swap.text, swap.rend, p, setrstyle); |
317 | scr_blank_screen_mem (drawn_text, drawn_rend, p, setrstyle); |
320 | scr_blank_screen_mem (drawn_text, drawn_rend, p, setrstyle); |
318 | } |
321 | } |
319 | |
322 | |
320 | if (k > 0) |
323 | if (k > 0) |
321 | { |
324 | { |
… | |
… | |
336 | } |
339 | } |
337 | |
340 | |
338 | /* resize columns */ |
341 | /* resize columns */ |
339 | if (ncol != prev_ncol) |
342 | if (ncol != prev_ncol) |
340 | { |
343 | { |
341 | int common = min (prev_ncol, ncol); |
|
|
342 | rxvt_salloc *ta = new rxvt_salloc (ncol * sizeof (text_t)); |
344 | rxvt_salloc *ta = new rxvt_salloc (ncol * sizeof (text_t)); |
343 | rxvt_salloc *ra = new rxvt_salloc (ncol * sizeof (rend_t)); |
345 | rxvt_salloc *ra = new rxvt_salloc (ncol * sizeof (rend_t)); |
344 | |
346 | |
345 | for (p = 0; p < total_rows; p++) |
347 | for (p = 0; p < total_rows; p++) |
346 | { |
348 | { |
347 | if (screen.text[p]) |
349 | if (screen.text[p]) |
348 | { |
350 | { |
349 | text_t *t = (text_t *)ta->alloc (); memcpy (t, screen.text[p], common * sizeof (text_t)); screen.text[p] = t; |
351 | screen.text[p] = (text_t *)ta->alloc (screen.text[p], prev_ncol * sizeof (text_t)); |
350 | rend_t *r = (rend_t *)ra->alloc (); memcpy (r, screen.rend[p], common * sizeof (rend_t)); screen.rend[p] = r; |
352 | screen.rend[p] = (rend_t *)ra->alloc (screen.rend[p], prev_ncol * sizeof (rend_t)); |
351 | |
353 | |
352 | MIN_IT (screen.tlen[p], (int16_t)ncol); |
354 | MIN_IT (screen.tlen[p], (int16_t)ncol); |
353 | |
355 | |
354 | if (ncol > prev_ncol) |
356 | if (ncol > prev_ncol) |
355 | scr_blank_line (& (screen.text[p][prev_ncol]), |
357 | scr_blank_line (&screen.text[p][prev_ncol], |
356 | & (screen.rend[p][prev_ncol]), |
358 | &screen.rend[p][prev_ncol], |
357 | ncol - prev_ncol, |
359 | ncol - prev_ncol, setrstyle); |
358 | setrstyle); |
|
|
359 | } |
360 | } |
360 | } |
361 | } |
361 | |
362 | |
362 | for (p = 0; p < nrow; p++) |
363 | for (p = 0; p < nrow; p++) |
363 | { |
364 | { |
364 | text_t *t = (text_t *)ta->alloc (); memcpy (t, drawn_text[p], common * sizeof (text_t)); drawn_text[p] = t; |
365 | drawn_text[p] = (text_t *)ta->alloc (drawn_text[p], prev_ncol * sizeof (text_t)); |
365 | rend_t *r = (rend_t *)ra->alloc (); memcpy (r, drawn_rend[p], common * sizeof (rend_t)); drawn_rend[p] = r; |
366 | drawn_rend[p] = (rend_t *)ra->alloc (drawn_rend[p], prev_ncol * sizeof (rend_t)); |
366 | |
367 | |
367 | if (ncol > prev_ncol) |
368 | if (ncol > prev_ncol) |
368 | scr_blank_line (& (drawn_text[p][prev_ncol]), |
369 | scr_blank_line (&drawn_text[p][prev_ncol], |
369 | & (drawn_rend[p][prev_ncol]), |
370 | &drawn_rend[p][prev_ncol], |
370 | ncol - prev_ncol, setrstyle); |
371 | ncol - prev_ncol, setrstyle); |
371 | |
372 | |
372 | if (swap.text[p]) |
373 | if (swap.text[p]) |
373 | { |
374 | { |
374 | text_t *t = (text_t *)ta->alloc (); memcpy (t, swap.text[p], common * sizeof (text_t)); swap.text[p] = t; |
375 | swap.text[p] = (text_t *)ta->alloc (swap.text[p], prev_ncol * sizeof (text_t)); |
375 | rend_t *r = (rend_t *)ra->alloc (); memcpy (r, swap.rend[p], common * sizeof (rend_t)); swap.rend[p] = r; |
376 | swap.rend[p] = (rend_t *)ra->alloc (swap.rend[p], prev_ncol * sizeof (rend_t)); |
376 | |
377 | |
377 | MIN_IT (swap.tlen[p], (int16_t)ncol); |
378 | MIN_IT (swap.tlen[p], (int16_t)ncol); |
378 | |
379 | |
379 | if (ncol > prev_ncol) |
380 | if (ncol > prev_ncol) |
380 | scr_blank_line (& (swap.text[p][prev_ncol]), |
381 | scr_blank_line (&swap.text[p][prev_ncol], |
381 | & (swap.rend[p][prev_ncol]), |
382 | &swap.rend[p][prev_ncol], |
382 | ncol - prev_ncol, setrstyle); |
383 | ncol - prev_ncol, setrstyle); |
383 | } |
384 | } |
384 | |
385 | |
385 | } |
386 | } |
386 | |
387 | |
… | |
… | |
476 | |
477 | |
477 | scr_release (); |
478 | scr_release (); |
478 | prev_nrow = prev_ncol = 0; |
479 | prev_nrow = prev_ncol = 0; |
479 | scr_reset (); |
480 | scr_reset (); |
480 | |
481 | |
481 | scr_clear (); |
482 | scr_clear (true); |
482 | scr_refresh (SLOW_REFRESH); |
483 | scr_refresh (SLOW_REFRESH); |
483 | } |
484 | } |
484 | |
485 | |
485 | /* ------------------------------------------------------------------------- * |
486 | /* ------------------------------------------------------------------------- * |
486 | * PROCESS SCREEN COMMANDS * |
487 | * PROCESS SCREEN COMMANDS * |
… | |
… | |
511 | s->s_cur.col = s->cur.col; |
512 | s->s_cur.col = s->cur.col; |
512 | s->s_rstyle = rstyle; |
513 | s->s_rstyle = rstyle; |
513 | s->s_charset = s->charset; |
514 | s->s_charset = s->charset; |
514 | s->s_charset_char = charsets[s->charset]; |
515 | s->s_charset_char = charsets[s->charset]; |
515 | break; |
516 | break; |
|
|
517 | |
516 | case RESTORE: |
518 | case RESTORE: |
517 | want_refresh = 1; |
519 | want_refresh = 1; |
518 | s->cur.row = s->s_cur.row; |
520 | s->cur.row = s->s_cur.row; |
519 | s->cur.col = s->s_cur.col; |
521 | s->cur.col = s->s_cur.col; |
520 | s->flags &= ~Screen_WrapNext; |
522 | s->flags &= ~Screen_WrapNext; |
… | |
… | |
556 | D_SCREEN ((stderr, "rxvt_scr_change_screen (%d)", scrn)); |
558 | D_SCREEN ((stderr, "rxvt_scr_change_screen (%d)", scrn)); |
557 | |
559 | |
558 | TermWin.view_start = 0; |
560 | TermWin.view_start = 0; |
559 | |
561 | |
560 | if (current_screen == scrn) |
562 | if (current_screen == scrn) |
561 | return current_screen; |
563 | return scrn; |
562 | |
564 | |
563 | selection_check (2); /* check for boundary cross */ |
565 | selection_check (2); /* check for boundary cross */ |
564 | |
566 | |
565 | SWAP_IT (current_screen, scrn, int); |
567 | SWAP_IT (current_screen, scrn, int); |
566 | #if NSCREENS |
568 | #if NSCREENS |
|
|
569 | if (Options & Opt_secondaryScreen) |
|
|
570 | { |
567 | num_scr = 0; |
571 | num_scr = 0; |
568 | offset = TermWin.saveLines; |
572 | offset = TermWin.saveLines; |
569 | for (i = prev_nrow; i--;) |
573 | for (i = prev_nrow; i--;) |
570 | { |
574 | { |
571 | SWAP_IT (screen.text[i + offset], swap.text[i], text_t *); |
575 | SWAP_IT (screen.text[i + offset], swap.text[i], text_t *); |
572 | SWAP_IT (screen.tlen[i + offset], swap.tlen[i], int16_t); |
576 | SWAP_IT (screen.tlen[i + offset], swap.tlen[i], int16_t); |
573 | SWAP_IT (screen.rend[i + offset], swap.rend[i], rend_t *); |
577 | SWAP_IT (screen.rend[i + offset], swap.rend[i], rend_t *); |
574 | } |
578 | } |
575 | SWAP_IT (screen.cur.row, swap.cur.row, int16_t); |
579 | SWAP_IT (screen.cur.row, swap.cur.row, int16_t); |
576 | SWAP_IT (screen.cur.col, swap.cur.col, int16_t); |
580 | SWAP_IT (screen.cur.col, swap.cur.col, int16_t); |
577 | # ifdef DEBUG_STRICT |
581 | # ifdef DEBUG_STRICT |
578 | assert ((screen.cur.row >= 0) && (screen.cur.row < prev_nrow)); |
582 | assert ((screen.cur.row >= 0) && (screen.cur.row < prev_nrow)); |
579 | assert ((screen.cur.col >= 0) && (screen.cur.col < prev_ncol)); |
583 | assert ((screen.cur.col >= 0) && (screen.cur.col < prev_ncol)); |
580 | # else /* drive with your eyes closed */ |
584 | # else /* drive with your eyes closed */ |
581 | MAX_IT (screen.cur.row, 0); |
585 | MAX_IT (screen.cur.row, 0); |
582 | MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); |
586 | MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); |
583 | MAX_IT (screen.cur.col, 0); |
587 | MAX_IT (screen.cur.col, 0); |
584 | MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1); |
588 | MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1); |
585 | # endif |
589 | # endif |
586 | SWAP_IT (screen.charset, swap.charset, int16_t); |
590 | SWAP_IT (screen.charset, swap.charset, int16_t); |
587 | SWAP_IT (screen.flags, swap.flags, int); |
591 | SWAP_IT (screen.flags, swap.flags, int); |
588 | screen.flags |= Screen_VisibleCursor; |
592 | screen.flags |= Screen_VisibleCursor; |
589 | swap.flags |= Screen_VisibleCursor; |
593 | swap.flags |= Screen_VisibleCursor; |
590 | #else |
594 | } |
591 | # ifdef SCROLL_ON_NO_SECONDARY |
595 | else |
|
|
596 | #endif |
|
|
597 | if (Options & Opt_secondaryScroll) |
592 | if (current_screen == PRIMARY) |
598 | //if (current_screen == PRIMARY) |
593 | scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0); |
599 | scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0); |
594 | # endif |
|
|
595 | #endif |
|
|
596 | return scrn; |
600 | return scrn; |
597 | } |
601 | } |
598 | |
602 | |
599 | /* ------------------------------------------------------------------------- */ |
603 | /* ------------------------------------------------------------------------- */ |
600 | /* |
604 | /* |
… | |
… | |
642 | return 0; |
646 | return 0; |
643 | |
647 | |
644 | want_refresh = 1; |
648 | want_refresh = 1; |
645 | D_SCREEN ((stderr, "rxvt_scroll_text (%d,%d,%d,%d): %s", row1, row2, count, spec, (current_screen == PRIMARY) ? "Primary" : "Secondary")); |
649 | D_SCREEN ((stderr, "rxvt_scroll_text (%d,%d,%d,%d): %s", row1, row2, count, spec, (current_screen == PRIMARY) ? "Primary" : "Secondary")); |
646 | |
650 | |
647 | if ((count > 0) && (row1 == 0) && (current_screen == PRIMARY)) |
651 | if (row1 == 0 && count > 0 |
|
|
652 | && (current_screen == PRIMARY || Options & Opt_secondaryScroll)) |
648 | { |
653 | { |
649 | nscrolled = (long)TermWin.nscrolled + (long)count; |
654 | nscrolled = (long)TermWin.nscrolled + (long)count; |
650 | |
655 | |
651 | if (nscrolled > (long)TermWin.saveLines) |
656 | if (nscrolled > (long)TermWin.saveLines) |
652 | TermWin.nscrolled = TermWin.saveLines; |
657 | TermWin.nscrolled = TermWin.saveLines; |
… | |
… | |
705 | for (i = 0, j = row1; i < count; i++, j++) |
710 | for (i = 0, j = row1; i < count; i++, j++) |
706 | { |
711 | { |
707 | buf_text[i] = screen.text[j]; |
712 | buf_text[i] = screen.text[j]; |
708 | buf_rend[i] = screen.rend[j]; |
713 | buf_rend[i] = screen.rend[j]; |
709 | } |
714 | } |
|
|
715 | |
710 | /* A2: Rotate lines */ |
716 | /* A2: Rotate lines */ |
711 | for (j = row1, i = j + count; i <= row2; i++, j++) |
717 | for (j = row1, i = j + count; i <= row2; i++, j++) |
712 | { |
718 | { |
713 | screen.tlen[j] = screen.tlen[i]; |
719 | screen.tlen[j] = screen.tlen[i]; |
714 | screen.text[j] = screen.text[i]; |
720 | screen.text[j] = screen.text[i]; |
715 | screen.rend[j] = screen.rend[i]; |
721 | screen.rend[j] = screen.rend[i]; |
716 | } |
722 | } |
|
|
723 | |
717 | j = row2 - count + 1, i = count; |
724 | j = row2 - count + 1, i = count; |
718 | } |
725 | } |
719 | else /* if (j < 0) */ |
726 | else /* if (j < 0) */ |
720 | { |
727 | { |
721 | /* B: scroll down */ |
728 | /* B: scroll down */ |
… | |
… | |
724 | for (i = 0, j = row2; i < count; i++, j--) |
731 | for (i = 0, j = row2; i < count; i++, j--) |
725 | { |
732 | { |
726 | buf_text[i] = screen.text[j]; |
733 | buf_text[i] = screen.text[j]; |
727 | buf_rend[i] = screen.rend[j]; |
734 | buf_rend[i] = screen.rend[j]; |
728 | } |
735 | } |
|
|
736 | |
729 | /* B2: Rotate lines */ |
737 | /* B2: Rotate lines */ |
730 | for (j = row2, i = j - count; i >= row1; i--, j--) |
738 | for (j = row2, i = j - count; i >= row1; i--, j--) |
731 | { |
739 | { |
732 | screen.tlen[j] = screen.tlen[i]; |
740 | screen.tlen[j] = screen.tlen[i]; |
733 | screen.text[j] = screen.text[i]; |
741 | screen.text[j] = screen.text[i]; |
734 | screen.rend[j] = screen.rend[i]; |
742 | screen.rend[j] = screen.rend[i]; |
735 | } |
743 | } |
|
|
744 | |
736 | j = row1, i = count; |
745 | j = row1, i = count; |
737 | count = -count; |
746 | count = -count; |
738 | } |
747 | } |
739 | |
748 | |
740 | /* C: Resurrect lines */ |
749 | /* C: Resurrect lines */ |
… | |
… | |
743 | screen.tlen[j] = 0; |
752 | screen.tlen[j] = 0; |
744 | screen.text[j] = buf_text[i]; |
753 | screen.text[j] = buf_text[i]; |
745 | screen.rend[j] = buf_rend[i]; |
754 | screen.rend[j] = buf_rend[i]; |
746 | |
755 | |
747 | if (!spec) /* line length may not equal TermWin.ncol */ |
756 | if (!spec) /* line length may not equal TermWin.ncol */ |
748 | scr_blank_screen_mem (screen.text, screen.rend, |
757 | scr_blank_screen_mem (screen.text, screen.rend, (unsigned int)j, rstyle); |
749 | (unsigned int)j, rstyle); |
|
|
750 | } |
758 | } |
751 | |
759 | |
752 | return count; |
760 | return count; |
753 | } |
761 | } |
754 | |
762 | |
… | |
… | |
786 | } |
794 | } |
787 | } |
795 | } |
788 | #ifdef DEBUG_STRICT |
796 | #ifdef DEBUG_STRICT |
789 | assert (screen.cur.col < last_col); |
797 | assert (screen.cur.col < last_col); |
790 | assert ((screen.cur.row < TermWin.nrow) |
798 | assert ((screen.cur.row < TermWin.nrow) |
791 | && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); |
799 | && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); |
792 | #else /* drive with your eyes closed */ |
800 | #else /* drive with your eyes closed */ |
793 | MIN_IT (screen.cur.col, last_col - 1); |
801 | MIN_IT (screen.cur.col, last_col - 1); |
794 | MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); |
802 | MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); |
795 | MAX_IT (screen.cur.row, - (int32_t)TermWin.nscrolled); |
803 | MAX_IT (screen.cur.row, - (int32_t)TermWin.nscrolled); |
796 | #endif |
804 | #endif |
… | |
… | |
807 | c = *str++; |
815 | c = *str++; |
808 | |
816 | |
809 | if (c < 0x20) |
817 | if (c < 0x20) |
810 | switch (c) |
818 | switch (c) |
811 | { |
819 | { |
812 | case '\t': |
820 | case C0_HT: |
813 | scr_tab (1); |
821 | scr_tab (1); |
814 | continue; |
822 | continue; |
815 | |
823 | |
816 | case '\n': |
824 | case C0_LF: |
817 | if (screen.tlen[row] != -1) /* XXX: think about this */ |
825 | if (screen.tlen[row] != -1) /* XXX: think about this */ |
818 | MAX_IT (screen.tlen[row], screen.cur.col); |
826 | MAX_IT (screen.tlen[row], screen.cur.col); |
819 | |
827 | |
820 | screen.flags &= ~Screen_WrapNext; |
828 | screen.flags &= ~Screen_WrapNext; |
821 | |
829 | |
… | |
… | |
826 | |
834 | |
827 | stp = screen.text[row]; /* _must_ refresh */ |
835 | stp = screen.text[row]; /* _must_ refresh */ |
828 | srp = screen.rend[row]; /* _must_ refresh */ |
836 | srp = screen.rend[row]; /* _must_ refresh */ |
829 | continue; |
837 | continue; |
830 | |
838 | |
831 | case '\r': |
839 | case C0_CR: |
832 | if (screen.tlen[row] != -1) /* XXX: think about this */ |
840 | if (screen.tlen[row] != -1) /* XXX: think about this */ |
833 | MAX_IT (screen.tlen[row], screen.cur.col); |
841 | MAX_IT (screen.tlen[row], screen.cur.col); |
834 | |
842 | |
835 | screen.flags &= ~Screen_WrapNext; |
843 | screen.flags &= ~Screen_WrapNext; |
836 | screen.cur.col = 0; |
844 | screen.cur.col = 0; |
… | |
… | |
882 | c = vt100_0[c - 0x5f]; |
890 | c = vt100_0[c - 0x5f]; |
883 | width = 1; |
891 | width = 1; |
884 | } |
892 | } |
885 | } |
893 | } |
886 | |
894 | |
887 | if (width > 0) |
895 | if (width != 0) |
888 | { |
896 | { |
889 | #if !UNICODE_3 && ENABLE_COMBINING |
897 | #if !UNICODE_3 && ENABLE_COMBINING |
890 | // trim characters we can't store directly :( |
898 | // trim characters we can't store directly :( |
891 | if (c >= 0x10000) |
899 | if (c >= 0x10000) |
892 | c = rxvt_composite.compose (c); // map to lower 16 bits |
900 | c = rxvt_composite.compose (c); // map to lower 16 bits |
893 | #endif |
901 | #endif |
894 | rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c)); |
902 | bool bold = (Options & Opt_realBold) && ((rstyle & RS_Bold) != 0); |
|
|
903 | rend_t rend = SET_FONT (rstyle, |
|
|
904 | c > 0x7f || bold || c < 0x20 |
|
|
905 | ? TermWin.fontset->find_font (c, bold) |
|
|
906 | : TermWin.ascii_map [c - 0x20]); |
895 | |
907 | |
896 | do |
908 | do |
897 | { |
909 | { |
898 | stp[screen.cur.col] = c; |
910 | stp[screen.cur.col] = c; |
899 | srp[screen.cur.col] = rend; |
911 | srp[screen.cur.col] = rend; |
… | |
… | |
984 | */ |
996 | */ |
985 | void |
997 | void |
986 | rxvt_term::scr_backspace () |
998 | rxvt_term::scr_backspace () |
987 | { |
999 | { |
988 | want_refresh = 1; |
1000 | want_refresh = 1; |
|
|
1001 | |
989 | if (screen.cur.col == 0) |
1002 | if (screen.cur.col == 0) |
990 | { |
1003 | { |
991 | if (screen.cur.row > 0) |
1004 | if (screen.cur.row > 0) |
992 | { |
1005 | { |
993 | #ifdef TERMCAP_HAS_BW |
1006 | #ifdef TERMCAP_HAS_BW |
… | |
… | |
998 | |
1011 | |
999 | } |
1012 | } |
1000 | } |
1013 | } |
1001 | else if ((screen.flags & Screen_WrapNext) == 0) |
1014 | else if ((screen.flags & Screen_WrapNext) == 0) |
1002 | scr_gotorc (0, -1, RELATIVE); |
1015 | scr_gotorc (0, -1, RELATIVE); |
|
|
1016 | |
1003 | screen.flags &= ~Screen_WrapNext; |
1017 | screen.flags &= ~Screen_WrapNext; |
1004 | } |
1018 | } |
1005 | |
1019 | |
1006 | /* ------------------------------------------------------------------------- */ |
1020 | /* ------------------------------------------------------------------------- */ |
1007 | /* |
1021 | /* |
… | |
… | |
1111 | want_refresh = 1; |
1125 | want_refresh = 1; |
1112 | ZERO_SCROLLBACK (); |
1126 | ZERO_SCROLLBACK (); |
1113 | |
1127 | |
1114 | D_SCREEN ((stderr, "rxvt_scr_gotorc (r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col)); |
1128 | D_SCREEN ((stderr, "rxvt_scr_gotorc (r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col)); |
1115 | |
1129 | |
1116 | screen.cur.col = ((relative & C_RELATIVE) ? (screen.cur.col + col) |
1130 | screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; |
1117 | : col); |
|
|
1118 | MAX_IT (screen.cur.col, 0); |
1131 | MAX_IT (screen.cur.col, 0); |
1119 | MIN_IT (screen.cur.col, (int32_t)TermWin.ncol - 1); |
1132 | MIN_IT (screen.cur.col, (int32_t)TermWin.ncol - 1); |
1120 | |
1133 | |
1121 | screen.flags &= ~Screen_WrapNext; |
1134 | screen.flags &= ~Screen_WrapNext; |
1122 | if (relative & R_RELATIVE) |
1135 | if (relative & R_RELATIVE) |
… | |
… | |
1161 | * direction should be UP or DN |
1174 | * direction should be UP or DN |
1162 | */ |
1175 | */ |
1163 | void |
1176 | void |
1164 | rxvt_term::scr_index (enum page_dirn direction) |
1177 | rxvt_term::scr_index (enum page_dirn direction) |
1165 | { |
1178 | { |
1166 | int dirn; |
1179 | int dirn; |
1167 | |
1180 | |
1168 | want_refresh = 1; |
1181 | want_refresh = 1; |
1169 | dirn = ((direction == UP) ? 1 : -1); |
1182 | dirn = ((direction == UP) ? 1 : -1); |
1170 | D_SCREEN ((stderr, "rxvt_scr_index (%d)", dirn)); |
1183 | D_SCREEN ((stderr, "rxvt_scr_index (%d)", dirn)); |
1171 | |
1184 | |
… | |
… | |
1231 | default: |
1244 | default: |
1232 | return; |
1245 | return; |
1233 | } |
1246 | } |
1234 | |
1247 | |
1235 | if (screen.text[row]) |
1248 | if (screen.text[row]) |
1236 | scr_blank_line (& (screen.text[row][col]), |
1249 | scr_blank_line (&screen.text[row][col], &screen.rend[row][col], num, rstyle); |
1237 | & (screen.rend[row][col]), num, rstyle); |
|
|
1238 | else |
1250 | else |
1239 | scr_blank_screen_mem (screen.text, screen.rend, row, rstyle); |
1251 | scr_blank_screen_mem (screen.text, screen.rend, row, rstyle); |
1240 | } |
1252 | } |
1241 | |
1253 | |
1242 | /* ------------------------------------------------------------------------- */ |
1254 | /* ------------------------------------------------------------------------- */ |
… | |
… | |
1514 | */ |
1526 | */ |
1515 | void |
1527 | void |
1516 | rxvt_term::scr_cursor_visible (int mode) |
1528 | rxvt_term::scr_cursor_visible (int mode) |
1517 | { |
1529 | { |
1518 | want_refresh = 1; |
1530 | want_refresh = 1; |
|
|
1531 | |
1519 | if (mode) |
1532 | if (mode) |
1520 | screen.flags |= Screen_VisibleCursor; |
1533 | screen.flags |= Screen_VisibleCursor; |
1521 | else |
1534 | else |
1522 | screen.flags &= ~Screen_VisibleCursor; |
1535 | screen.flags &= ~Screen_VisibleCursor; |
1523 | } |
1536 | } |
… | |
… | |
1737 | row_col_t rc[RC_COUNT]; |
1750 | row_col_t rc[RC_COUNT]; |
1738 | |
1751 | |
1739 | if (drawn_text == NULL) /* sanity check */ |
1752 | if (drawn_text == NULL) /* sanity check */ |
1740 | return; |
1753 | return; |
1741 | |
1754 | |
|
|
1755 | #ifndef NO_SLOW_LINK_SUPPORT |
|
|
1756 | if (refresh_type == FAST_REFRESH && !display->is_local) |
|
|
1757 | { |
|
|
1758 | y = 0; |
|
|
1759 | height = TermWin.height; |
|
|
1760 | } |
|
|
1761 | #endif |
|
|
1762 | |
1742 | #ifdef DEBUG_STRICT |
1763 | #ifdef DEBUG_STRICT |
1743 | x = max (x, (int)TermWin.int_bwidth); |
1764 | x = max (x, 0); |
1744 | x = min (x, (int)TermWin.width); |
1765 | x = min (x, (int)TermWin.width); |
1745 | y = max (y, (int)TermWin.int_bwidth); |
1766 | y = max (y, 0); |
1746 | y = min (y, (int)TermWin.height); |
1767 | y = min (y, (int)TermWin.height); |
1747 | #endif |
1768 | #endif |
1748 | |
1769 | |
1749 | /* round down */ |
1770 | /* round down */ |
1750 | rc[PART_BEG].col = Pixel2Col (x); |
1771 | rc[PART_BEG].col = Pixel2Col (x); |
… | |
… | |
1761 | } |
1782 | } |
1762 | |
1783 | |
1763 | D_SCREEN ((stderr, "rxvt_scr_expose (x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)- (c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row)); |
1784 | D_SCREEN ((stderr, "rxvt_scr_expose (x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)- (c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row)); |
1764 | |
1785 | |
1765 | for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) |
1786 | for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) |
1766 | fill_text (& (drawn_text[i][rc[PART_BEG].col]), 0, |
1787 | fill_text (&drawn_text[i][rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); |
1767 | (rc[PART_END].col - rc[PART_BEG].col + 1)); |
|
|
1768 | |
1788 | |
1769 | if (refresh) |
1789 | if (refresh) |
1770 | scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS); |
1790 | scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS); |
1771 | } |
1791 | } |
1772 | |
1792 | |
… | |
… | |
1839 | if (TermWin.view_start != oldviewstart) |
1859 | if (TermWin.view_start != oldviewstart) |
1840 | { |
1860 | { |
1841 | want_refresh = 1; |
1861 | want_refresh = 1; |
1842 | num_scr -= (TermWin.view_start - oldviewstart); |
1862 | num_scr -= (TermWin.view_start - oldviewstart); |
1843 | } |
1863 | } |
|
|
1864 | |
1844 | return (int) (TermWin.view_start - oldviewstart); |
1865 | return (int) (TermWin.view_start - oldviewstart); |
1845 | } |
1866 | } |
1846 | |
1867 | |
1847 | /* ------------------------------------------------------------------------- */ |
1868 | /* ------------------------------------------------------------------------- */ |
1848 | void |
1869 | void |
… | |
… | |
2045 | /* |
2066 | /* |
2046 | * D: CopyArea pass - very useful for slower links |
2067 | * D: CopyArea pass - very useful for slower links |
2047 | * This has been deliberately kept simple. |
2068 | * This has been deliberately kept simple. |
2048 | */ |
2069 | */ |
2049 | i = num_scr; |
2070 | i = num_scr; |
|
|
2071 | if (!display->is_local |
2050 | if (refresh_type == FAST_REFRESH && num_scr_allow && i |
2072 | && refresh_type == FAST_REFRESH && num_scr_allow && i |
2051 | && abs (i) < TermWin.nrow && !must_clear) |
2073 | && abs (i) < TermWin.nrow && !must_clear) |
2052 | { |
2074 | { |
2053 | int16_t nits; |
2075 | int16_t nits; |
2054 | int j; |
2076 | int j; |
2055 | rend_t *drp2; |
2077 | rend_t *drp2; |
… | |
… | |
2197 | rend = GET_ATTR (rend); |
2219 | rend = GET_ATTR (rend); |
2198 | |
2220 | |
2199 | rvid = !!(rend & RS_RVid); |
2221 | rvid = !!(rend & RS_RVid); |
2200 | |
2222 | |
2201 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2223 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2202 | if (rend & RS_Bold && fore == Color_fg) |
2224 | if (rend & RS_Bold && fore == Color_fg && !(Options & Opt_realBold)) |
2203 | { |
2225 | { |
2204 | if (ISSET_PIXCOLOR (Color_BD)) |
2226 | if (ISSET_PIXCOLOR (Color_BD)) |
2205 | fore = Color_BD; |
2227 | fore = Color_BD; |
2206 | else |
2228 | else |
2207 | rvid = !rvid; |
2229 | rvid = !rvid; |
… | |
… | |
2225 | back = Color_RV; |
2247 | back = Color_RV; |
2226 | #endif |
2248 | #endif |
2227 | } |
2249 | } |
2228 | |
2250 | |
2229 | #ifdef TEXT_BLINK |
2251 | #ifdef TEXT_BLINK |
2230 | if (rend & RS_Blink && back == Color_bg) |
2252 | if (rend & RS_Blink && (back == Color_bg || fore == Color_bg)) |
2231 | { |
2253 | { |
2232 | if (!text_blink_ev.active) |
2254 | if (!text_blink_ev.active) |
2233 | { |
2255 | { |
2234 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
2256 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
2235 | hidden_text = 0; |
2257 | hidden_text = 0; |
… | |
… | |
2265 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); |
2287 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); |
2266 | } |
2288 | } |
2267 | else |
2289 | else |
2268 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); |
2290 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); |
2269 | |
2291 | |
2270 | if ((rend & RS_Uline) && (font->descent > 1)) |
2292 | if (rend & RS_Uline && font->descent > 1 && fore != back) |
2271 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2293 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2272 | xpixel, ypixel + font->ascent + 1, |
2294 | xpixel, ypixel + font->ascent + 1, |
2273 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2295 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2274 | } /* for (col....) */ |
2296 | } /* for (col....) */ |
2275 | } /* for (row....) */ |
2297 | } /* for (row....) */ |
… | |
… | |
2313 | scr_reverse_selection (); |
2335 | scr_reverse_selection (); |
2314 | |
2336 | |
2315 | /* |
2337 | /* |
2316 | * I: other general cleanup |
2338 | * I: other general cleanup |
2317 | */ |
2339 | */ |
|
|
2340 | #if 0 |
2318 | if (clearfirst && TermWin.int_bwidth) |
2341 | if (clearfirst && TermWin.int_bwidth) |
2319 | /* |
2342 | /* |
2320 | * clear the whole screen height, note that width == 0 is treated |
2343 | * clear the whole screen height, note that width == 0 is treated |
2321 | * specially by XClearArea |
2344 | * specially by XClearArea |
2322 | */ |
2345 | */ |
… | |
… | |
2331 | */ |
2354 | */ |
2332 | XClearArea (display->display, TermWin.vt, |
2355 | XClearArea (display->display, TermWin.vt, |
2333 | TermWin.width + TermWin.int_bwidth, 0, |
2356 | TermWin.width + TermWin.int_bwidth, 0, |
2334 | (unsigned int)TermWin.int_bwidth, |
2357 | (unsigned int)TermWin.int_bwidth, |
2335 | (unsigned int)TermWin_TotalHeight (), False); |
2358 | (unsigned int)TermWin_TotalHeight (), False); |
|
|
2359 | #endif |
2336 | |
2360 | |
2337 | if (refresh_type & SMOOTH_REFRESH) |
2361 | if (refresh_type & SMOOTH_REFRESH) |
2338 | XSync (display->display, False); |
2362 | XFlush (display->display); |
2339 | |
2363 | |
2340 | num_scr = 0; |
2364 | num_scr = 0; |
2341 | num_scr_allow = 1; |
2365 | num_scr_allow = 1; |
2342 | want_refresh = 0; /* screen is current */ |
2366 | want_refresh = 0; /* screen is current */ |
2343 | } |
2367 | } |
… | |
… | |
2514 | { |
2538 | { |
2515 | n = min (len - i, PROP_SIZE); |
2539 | n = min (len - i, PROP_SIZE); |
2516 | MEMCPY (ds, data + i, n); |
2540 | MEMCPY (ds, data + i, n); |
2517 | |
2541 | |
2518 | for (j = 0; j < n; j++) |
2542 | for (j = 0; j < n; j++) |
2519 | if (ds[j] == '\n') |
2543 | if (ds[j] == C0_LF) |
2520 | ds[j] = '\r'; |
2544 | ds[j] = C0_CR; |
2521 | |
2545 | |
2522 | tt_write (ds, (int)n); |
2546 | tt_write (ds, (int)n); |
2523 | } |
2547 | } |
2524 | |
2548 | |
2525 | free (ds); |
2549 | free (ds); |
… | |
… | |
2606 | |
2630 | |
2607 | nread += ct.nitems; |
2631 | nread += ct.nitems; |
2608 | |
2632 | |
2609 | char **cl; |
2633 | char **cl; |
2610 | int cr; |
2634 | int cr; |
2611 | if (XmbTextPropertyToTextList (display->display, &ct, &cl, |
2635 | if (XmbTextPropertyToTextList (display->display, &ct, &cl, &cr) >= 0 && cl) |
2612 | &cr) >= 0 && cl) |
|
|
2613 | { |
2636 | { |
2614 | for (int i = 0; i < cr; i++) |
2637 | for (int i = 0; i < cr; i++) |
2615 | paste ((unsigned char *)cl[i], STRLEN (cl[i])); |
2638 | paste ((unsigned char *)cl[i], STRLEN (cl[i])); |
2616 | |
2639 | |
2617 | XFreeStringList (cl); |
2640 | XFreeStringList (cl); |
… | |
… | |
2876 | else |
2899 | else |
2877 | new_selection_text[ofs++] = *t++; |
2900 | new_selection_text[ofs++] = *t++; |
2878 | } |
2901 | } |
2879 | |
2902 | |
2880 | if (screen.tlen[row] != -1 && row != end_row) |
2903 | if (screen.tlen[row] != -1 && row != end_row) |
2881 | new_selection_text[ofs++] = L'\n'; |
2904 | new_selection_text[ofs++] = C0_LF; |
2882 | } |
2905 | } |
2883 | |
2906 | |
2884 | if (end_col != selection.end.col) |
2907 | if (end_col != selection.end.col) |
2885 | new_selection_text[ofs++] = L'\n'; |
2908 | new_selection_text[ofs++] = C0_LF; |
2886 | |
2909 | |
2887 | new_selection_text[ofs] = 0; |
2910 | new_selection_text[ofs] = 0; |
2888 | |
2911 | |
2889 | if (ofs == 0) |
2912 | if (ofs == 0) |
2890 | { |
2913 | { |
… | |
… | |
3117 | * Extend the selection to the specified col/row |
3140 | * Extend the selection to the specified col/row |
3118 | */ |
3141 | */ |
3119 | void |
3142 | void |
3120 | rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) |
3143 | rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) |
3121 | { |
3144 | { |
3122 | int16_t ncol = TermWin.ncol; |
3145 | int16_t ncol = TermWin.ncol; |
3123 | int end_col; |
3146 | int end_col; |
3124 | row_col_t pos; |
3147 | row_col_t pos; |
3125 | enum { |
3148 | enum { |
3126 | LEFT, RIGHT |
3149 | LEFT, RIGHT |
3127 | } closeto = RIGHT; |
3150 | } closeto = RIGHT; |
3128 | |
3151 | |
3129 | D_SELECT ((stderr, "rxvt_selection_extend_colrow (c:%d, r:%d, %d, %d) clicks:%d, op:%d", col, row, button3, buttonpress, selection.clicks, selection.op)); |
3152 | D_SELECT ((stderr, "rxvt_selection_extend_colrow (c:%d, r:%d, %d, %d) clicks:%d, op:%d", col, row, button3, buttonpress, selection.clicks, selection.op)); |
… | |
… | |
3512 | pos->y = Height2Pixel ((screen.cur.row + 1)) + xwa.y - TermWin.lineSpace; |
3535 | pos->y = Height2Pixel ((screen.cur.row + 1)) + xwa.y - TermWin.lineSpace; |
3513 | } |
3536 | } |
3514 | |
3537 | |
3515 | #endif |
3538 | #endif |
3516 | /* ------------------------------------------------------------------------- */ |
3539 | /* ------------------------------------------------------------------------- */ |
3517 | |
|
|
3518 | /* ------------------------------------------------------------------------- * |
|
|
3519 | * DEBUG ROUTINES * |
|
|
3520 | * ------------------------------------------------------------------------- */ |
|
|
3521 | #if 0 |
|
|
3522 | void |
|
|
3523 | rxvt_debug_colors (void) |
|
|
3524 | { |
|
|
3525 | int color; |
|
|
3526 | const char *name[] = |
|
|
3527 | { |
|
|
3528 | "fg", "bg", |
|
|
3529 | "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" |
|
|
3530 | }; |
|
|
3531 | |
|
|
3532 | fprintf (stderr, "Color ( "); |
|
|
3533 | if (rstyle & RS_RVid) |
|
|
3534 | fprintf (stderr, "rvid "); |
|
|
3535 | if (rstyle & RS_Bold) |
|
|
3536 | fprintf (stderr, "bold "); |
|
|
3537 | if (rstyle & RS_Blink) |
|
|
3538 | fprintf (stderr, "blink "); |
|
|
3539 | if (rstyle & RS_Uline) |
|
|
3540 | fprintf (stderr, "uline "); |
|
|
3541 | fprintf (stderr, "): "); |
|
|
3542 | |
|
|
3543 | color = GET_FGCOLOR (rstyle); |
|
|
3544 | #ifndef NO_BRIGHTCOLOR |
|
|
3545 | if (color >= minBrightCOLOR && color <= maxBrightCOLOR) |
|
|
3546 | { |
|
|
3547 | color -= (minBrightCOLOR - minCOLOR); |
|
|
3548 | fprintf (stderr, "bright "); |
|
|
3549 | } |
|
|
3550 | #endif |
|
|
3551 | fprintf (stderr, "%s on ", name[color]); |
|
|
3552 | |
|
|
3553 | color = GET_BGCOLOR (rstyle); |
|
|
3554 | #ifndef NO_BRIGHTCOLOR |
|
|
3555 | if (color >= minBrightCOLOR && color <= maxBrightCOLOR) |
|
|
3556 | { |
|
|
3557 | color -= (minBrightCOLOR - minCOLOR); |
|
|
3558 | fprintf (stderr, "bright "); |
|
|
3559 | } |
|
|
3560 | #endif |
|
|
3561 | fprintf (stderr, "%s\n", name[color]); |
|
|
3562 | } |
|
|
3563 | #endif |
|
|