… | |
… | |
24 | * This file handles _all_ screen updates and selections |
24 | * This file handles _all_ screen updates and selections |
25 | */ |
25 | */ |
26 | |
26 | |
27 | #include "../config.h" /* NECESSARY */ |
27 | #include "../config.h" /* NECESSARY */ |
28 | #include "rxvt.h" /* NECESSARY */ |
28 | #include "rxvt.h" /* NECESSARY */ |
|
|
29 | #include "rxvtperl.h" /* NECESSARY */ |
29 | |
30 | |
30 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
31 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
31 | |
32 | |
32 | #include <inttypes.h> |
33 | #include <inttypes.h> |
33 | |
34 | |
… | |
… | |
46 | |
47 | |
47 | /* ------------------------------------------------------------------------- * |
48 | /* ------------------------------------------------------------------------- * |
48 | * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * |
49 | * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * |
49 | * ------------------------------------------------------------------------- */ |
50 | * ------------------------------------------------------------------------- */ |
50 | #define ZERO_SCROLLBACK() \ |
51 | #define ZERO_SCROLLBACK() \ |
51 | if (options & Opt_scrollTtyOutput) \ |
52 | if (OPTION (Opt_scrollTtyOutput)) \ |
52 | view_start = 0 |
53 | view_start = 0 |
53 | #define CLEAR_SELECTION() \ |
54 | #define CLEAR_SELECTION() \ |
54 | selection.beg.row = selection.beg.col \ |
55 | selection.beg.row = selection.beg.col \ |
55 | = selection.end.row = selection.end.col = 0 |
56 | = selection.end.row = selection.end.col = 0 |
56 | #define CLEAR_ALL_SELECTION() \ |
57 | #define CLEAR_ALL_SELECTION() \ |
… | |
… | |
283 | // to come up with a lean and mean algorithm. |
284 | // to come up with a lean and mean algorithm. |
284 | |
285 | |
285 | row_col_t ocur = screen.cur; |
286 | row_col_t ocur = screen.cur; |
286 | ocur.row = MOD (term_start + ocur.row, prev_total_rows); |
287 | ocur.row = MOD (term_start + ocur.row, prev_total_rows); |
287 | |
288 | |
288 | while (p != pend && q > 0) |
289 | do |
289 | { |
290 | { |
290 | p = MOD (p - 1, prev_total_rows); |
291 | p = MOD (p - 1, prev_total_rows); |
291 | #ifdef DEBUG_STRICT |
292 | #ifdef DEBUG_STRICT |
292 | assert (old_buf [MOD (p, prev_total_rows)].t); |
293 | assert (old_buf [MOD (p, prev_total_rows)].t); |
293 | #endif |
294 | #endif |
… | |
… | |
351 | lofs += len; |
352 | lofs += len; |
352 | qcol += len; |
353 | qcol += len; |
353 | } |
354 | } |
354 | } |
355 | } |
355 | |
356 | |
356 | qline->l = llen < ncol ? llen : MOD (llen - 1, ncol) + 1; |
357 | qline->l = llen ? MOD (llen - 1, ncol) + 1 : 0; |
|
|
358 | #ifdef DEBUG_STRICT //TODO//FIXME//TEMPORARY |
|
|
359 | if (qline->l < 0) |
|
|
360 | { |
|
|
361 | fprintf (stderr, "ERROR, PLEASE REPORT to rxvt-unicode@plan9.de: qline->l %d = llen %d < ncol %d ? %d : MOD %d\n", qline->l,llen,ncol,llen,MOD (llen - 1, ncol) + 1);//D |
|
|
362 | qline->l = 0; |
|
|
363 | } |
|
|
364 | #endif |
357 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
365 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
358 | } |
366 | } |
|
|
367 | while (p != pend && q > 0); |
359 | |
368 | |
360 | term_start = total_rows - nrow; |
369 | term_start = total_rows - nrow; |
361 | view_start = 0; |
|
|
362 | nsaved = term_start - q; |
370 | nsaved = term_start - q; |
363 | |
371 | |
364 | // make sure all terminal lines exist |
372 | // make sure all terminal lines exist |
365 | while (nsaved < 0) |
373 | while (nsaved < 0) |
366 | scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE); |
374 | scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE); |
… | |
… | |
383 | { |
391 | { |
384 | row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); |
392 | row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); |
385 | } |
393 | } |
386 | |
394 | |
387 | term_start = 0; |
395 | term_start = 0; |
388 | view_start = 0; |
|
|
389 | } |
396 | } |
390 | |
397 | |
391 | #ifdef DEBUG_STRICT |
398 | #ifdef DEBUG_STRICT //TODO: remove |
392 | for (int i = -nsaved; i < nrow; i++) |
399 | for (int i = -nsaved; i < nrow; i++) |
393 | assert (ROW (i).t); |
400 | assert (ROW (i).t); |
394 | #endif |
401 | #endif |
395 | |
402 | |
396 | free (old_buf); |
403 | free (old_buf); |
… | |
… | |
411 | |
418 | |
412 | for (int col = ncol; col--; ) |
419 | for (int col = ncol; col--; ) |
413 | tabs [col] = col % TABSIZE == 0; |
420 | tabs [col] = col % TABSIZE == 0; |
414 | |
421 | |
415 | tt_winch (); |
422 | tt_winch (); |
|
|
423 | |
|
|
424 | PERL_INVOKE ((this, HOOK_RESET, DT_END)); |
416 | } |
425 | } |
417 | |
426 | |
418 | /* ------------------------------------------------------------------------- */ |
427 | /* ------------------------------------------------------------------------- */ |
419 | /* |
428 | /* |
420 | * Free everything. That way malloc debugging can find leakage. |
429 | * Free everything. That way malloc debugging can find leakage. |
… | |
… | |
524 | |
533 | |
525 | screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); |
534 | screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); |
526 | screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); |
535 | screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); |
527 | |
536 | |
528 | #if NSCREENS |
537 | #if NSCREENS |
529 | if (options & Opt_secondaryScreen) |
538 | if (OPTION (Opt_secondaryScreen)) |
530 | { |
539 | { |
531 | num_scr = 0; |
540 | num_scr = 0; |
532 | |
541 | |
533 | for (int i = prev_nrow; i--; ) |
542 | for (int i = prev_nrow; i--; ) |
534 | ::swap (ROW(i), swap_buf [i]); |
543 | ::swap (ROW(i), swap_buf [i]); |
… | |
… | |
538 | screen.flags |= Screen_VisibleCursor; |
547 | screen.flags |= Screen_VisibleCursor; |
539 | swap.flags |= Screen_VisibleCursor; |
548 | swap.flags |= Screen_VisibleCursor; |
540 | } |
549 | } |
541 | else |
550 | else |
542 | #endif |
551 | #endif |
543 | if (options & Opt_secondaryScroll) |
552 | if (OPTION (Opt_secondaryScroll)) |
544 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
553 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
545 | |
554 | |
546 | return scrn; |
555 | return scrn; |
547 | } |
556 | } |
548 | |
557 | |
… | |
… | |
610 | num_scr += count; |
619 | num_scr += count; |
611 | |
620 | |
612 | if (count > 0 |
621 | if (count > 0 |
613 | && row1 == 0 |
622 | && row1 == 0 |
614 | && row2 == nrow - 1 |
623 | && row2 == nrow - 1 |
615 | && (current_screen == PRIMARY || options & Opt_secondaryScroll)) |
624 | && (current_screen == PRIMARY || OPTION (Opt_secondaryScroll))) |
616 | { |
625 | { |
617 | nsaved = min (nsaved + count, saveLines); |
626 | nsaved = min (nsaved + count, saveLines); |
|
|
627 | |
|
|
628 | PERL_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, nsaved, DT_END)); |
|
|
629 | |
618 | term_start = (term_start + count) % total_rows; |
630 | term_start = (term_start + count) % total_rows; |
619 | |
631 | |
620 | if (selection.op && current_screen == selection.screen) |
632 | if (selection.op && current_screen == selection.screen) |
621 | { |
633 | { |
622 | selection.beg.row -= count; |
634 | selection.beg.row -= count; |
623 | selection.end.row -= count; |
635 | selection.end.row -= count; |
624 | selection.mark.row -= count; |
636 | selection.mark.row -= count; |
625 | |
637 | |
626 | selection_check (0); |
638 | if (selection.beg.row < -nsaved |
|
|
639 | || selection.end.row < -nsaved |
|
|
640 | || selection.mark.row < -nsaved) |
|
|
641 | { |
|
|
642 | CLEAR_ALL_SELECTION (); |
|
|
643 | selection.op = SELECTION_CLEAR; |
|
|
644 | } |
627 | } |
645 | } |
628 | |
646 | |
629 | for (int i = count; i--; ) |
647 | for (int i = count; i--; ) |
|
|
648 | { |
|
|
649 | ROW(row2 - i).l = 0; |
630 | scr_blank_screen_mem (ROW(row2 - i), rstyle); |
650 | scr_blank_screen_mem (ROW(row2 - i), rstyle); |
|
|
651 | } |
631 | |
652 | |
632 | if ((options & Opt_scrollWithBuffer) |
653 | if (OPTION (Opt_scrollWithBuffer) |
633 | && view_start != 0 |
654 | && view_start != 0 |
634 | && view_start != saveLines) |
655 | && view_start != saveLines) |
635 | scr_page (UP, count); |
656 | scr_page (UP, count); |
636 | } |
657 | } |
637 | else |
658 | else |
638 | { |
659 | { |
639 | if (selection.op && current_screen == selection.screen) |
660 | if (selection.op && current_screen == selection.screen) |
640 | { |
661 | { |
641 | int i = selection.beg.row; |
662 | if ((selection.beg.row < row1 && selection.end.row > row1) |
642 | int j = selection.end.row; |
663 | || (selection.beg.row < row2 && selection.end.row > row2) |
643 | |
|
|
644 | if ((i < row1 && j > row1) |
|
|
645 | || (i < row2 && j > row2) |
|
|
646 | || (i - count < row1 && i >= row1) |
664 | || (selection.beg.row - count < row1 && selection.beg.row >= row1) |
647 | || (i - count > row2 && i <= row2) |
665 | || (selection.beg.row - count > row2 && selection.beg.row <= row2) |
648 | || (j - count < row1 && j >= row1) |
666 | || (selection.end.row - count < row1 && selection.end.row >= row1) |
649 | || (j - count > row2 && j <= row2)) |
667 | || (selection.end.row - count > row2 && selection.end.row <= row2)) |
650 | { |
668 | { |
651 | CLEAR_ALL_SELECTION (); |
669 | CLEAR_ALL_SELECTION (); |
652 | selection.op = SELECTION_CLEAR; /* XXX: too aggressive? */ |
670 | selection.op = SELECTION_CLEAR; |
653 | } |
671 | } |
654 | else if (j >= row1 && j <= row2) |
672 | else if (selection.end.row >= row1 && selection.end.row <= row2) |
655 | { |
673 | { |
656 | /* move selected region too */ |
674 | /* move selected region too */ |
657 | selection.beg.row -= count; |
675 | selection.beg.row -= count; |
658 | selection.end.row -= count; |
676 | selection.end.row -= count; |
659 | selection.mark.row -= count; |
677 | selection.mark.row -= count; |
… | |
… | |
694 | if (len <= 0) /* sanity */ |
712 | if (len <= 0) /* sanity */ |
695 | return; |
713 | return; |
696 | |
714 | |
697 | unsigned char checksel; |
715 | unsigned char checksel; |
698 | unicode_t c; |
716 | unicode_t c; |
699 | int row, last_col; |
717 | int last_col; |
700 | const unicode_t *strend = str + len; |
718 | const unicode_t *strend = str + len; |
701 | |
719 | |
702 | want_refresh = 1; |
720 | want_refresh = 1; |
703 | ZERO_SCROLLBACK (); |
721 | ZERO_SCROLLBACK (); |
704 | last_col = ncol; |
722 | last_col = ncol; |
… | |
… | |
719 | #ifdef DEBUG_STRICT |
737 | #ifdef DEBUG_STRICT |
720 | assert (screen.cur.col < last_col); |
738 | assert (screen.cur.col < last_col); |
721 | assert (screen.cur.row < nrow |
739 | assert (screen.cur.row < nrow |
722 | && screen.cur.row >= -nsaved); |
740 | && screen.cur.row >= -nsaved); |
723 | #endif |
741 | #endif |
724 | row = screen.cur.row; |
742 | int row = screen.cur.row; |
725 | |
743 | |
726 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
744 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
727 | |
745 | |
728 | line_t *line = &ROW(row); |
746 | line_t *line = &ROW(row); |
729 | |
747 | |
… | |
… | |
731 | { |
749 | { |
732 | c = *str++; |
750 | c = *str++; |
733 | |
751 | |
734 | if (c < 0x20) |
752 | if (c < 0x20) |
735 | if (c == C0_LF) |
753 | if (c == C0_LF) |
736 | { |
754 | { |
737 | if (!line->is_longer ()) /* XXX: think about this */ |
755 | if (!line->is_longer ()) /* XXX: think about this */ |
738 | max_it (line->l, screen.cur.col); |
756 | max_it (line->l, screen.cur.col); |
739 | |
757 | |
740 | screen.flags &= ~Screen_WrapNext; |
758 | screen.flags &= ~Screen_WrapNext; |
741 | |
759 | |
… | |
… | |
986 | |
1004 | |
987 | if (count == 0) |
1005 | if (count == 0) |
988 | return; |
1006 | return; |
989 | else if (count > 0) |
1007 | else if (count > 0) |
990 | { |
1008 | { |
991 | int row = screen.cur.row; |
|
|
992 | |
|
|
993 | line_t &l = ROW(row); |
1009 | line_t &l = ROW(screen.cur.row); |
994 | rend_t base_rend = l.r[i]; |
1010 | rend_t base_rend = l.r[i]; |
995 | ht &= l.t[i] == ' '; |
1011 | ht &= l.t[i] == ' '; |
996 | |
1012 | |
997 | for (; ++i < ncol; ) |
1013 | for (; ++i < ncol; ) |
998 | if (tabs[i]) |
1014 | if (tabs[i]) |
… | |
… | |
1008 | if (count) |
1024 | if (count) |
1009 | x = ncol - 1; |
1025 | x = ncol - 1; |
1010 | |
1026 | |
1011 | // store horizontal tab commands as characters inside the text |
1027 | // store horizontal tab commands as characters inside the text |
1012 | // buffer so they can be selected and pasted. |
1028 | // buffer so they can be selected and pasted. |
1013 | if (ht && options & Opt_pastableTabs) |
1029 | if (ht && OPTION (Opt_pastableTabs)) |
1014 | { |
1030 | { |
1015 | base_rend = SET_FONT (base_rend, 0); |
1031 | base_rend = SET_FONT (base_rend, 0); |
1016 | |
1032 | |
1017 | if (!l.is_longer ()) /* XXX: think about this */ |
1033 | if (!l.is_longer ()) /* XXX: think about this */ |
1018 | max_it (l.l, x); |
1034 | max_it (l.l, x); |
… | |
… | |
1073 | */ |
1089 | */ |
1074 | #if ENABLE_FRILLS |
1090 | #if ENABLE_FRILLS |
1075 | void |
1091 | void |
1076 | rxvt_term::scr_forwardindex () |
1092 | rxvt_term::scr_forwardindex () |
1077 | { |
1093 | { |
1078 | int row; |
|
|
1079 | |
|
|
1080 | if (screen.cur.col < ncol - 1) |
1094 | if (screen.cur.col < ncol - 1) |
1081 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1095 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1082 | else |
1096 | else |
1083 | { |
1097 | { |
1084 | row = screen.cur.row; |
|
|
1085 | |
|
|
1086 | if (ROW(row).is_longer ()) //TODO//FIXME//LEN |
1098 | if (ROW(screen.cur.row).is_longer ()) //TODO//FIXME//LEN |
1087 | ROW(row).l = ncol; |
1099 | ROW(screen.cur.row).l = ncol; |
1088 | |
1100 | |
1089 | scr_gotorc (0, 0, R_RELATIVE); |
1101 | scr_gotorc (0, 0, R_RELATIVE); |
1090 | scr_insdel_chars (1, DELETE); |
1102 | scr_insdel_chars (1, DELETE); |
1091 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1103 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1092 | } |
1104 | } |
… | |
… | |
1175 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1187 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1176 | */ |
1188 | */ |
1177 | void |
1189 | void |
1178 | rxvt_term::scr_erase_line (int mode) |
1190 | rxvt_term::scr_erase_line (int mode) |
1179 | { |
1191 | { |
1180 | unsigned int row, col, num; |
1192 | unsigned int col, num; |
1181 | |
1193 | |
1182 | want_refresh = 1; |
1194 | want_refresh = 1; |
1183 | ZERO_SCROLLBACK (); |
1195 | ZERO_SCROLLBACK (); |
1184 | |
1196 | |
1185 | selection_check (1); |
1197 | selection_check (1); |
1186 | |
1198 | |
1187 | row = screen.cur.row; |
1199 | line_t &line = ROW(screen.cur.row); |
1188 | |
1200 | |
1189 | switch (mode) |
1201 | switch (mode) |
1190 | { |
1202 | { |
1191 | case 0: /* erase to end of line */ |
1203 | case 0: /* erase to end of line */ |
1192 | col = screen.cur.col; |
1204 | col = screen.cur.col; |
1193 | num = ncol - col; |
1205 | num = ncol - col; |
1194 | min_it (ROW(row).l, col); |
1206 | min_it (line.l, col); |
1195 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1207 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1196 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1208 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1197 | CLEAR_SELECTION (); |
1209 | CLEAR_SELECTION (); |
1198 | break; |
1210 | break; |
1199 | case 1: /* erase to beginning of line */ |
1211 | case 1: /* erase to beginning of line */ |
… | |
… | |
1204 | CLEAR_SELECTION (); |
1216 | CLEAR_SELECTION (); |
1205 | break; |
1217 | break; |
1206 | case 2: /* erase whole line */ |
1218 | case 2: /* erase whole line */ |
1207 | col = 0; |
1219 | col = 0; |
1208 | num = ncol; |
1220 | num = ncol; |
1209 | ROW(row).l = 0; |
1221 | line.l = 0; |
1210 | if (selection.beg.row <= screen.cur.row |
1222 | if (selection.beg.row <= screen.cur.row |
1211 | && selection.end.row >= screen.cur.row) |
1223 | && selection.end.row >= screen.cur.row) |
1212 | CLEAR_SELECTION (); |
1224 | CLEAR_SELECTION (); |
1213 | break; |
1225 | break; |
1214 | default: |
1226 | default: |
1215 | return; |
1227 | return; |
1216 | } |
1228 | } |
1217 | |
1229 | |
1218 | scr_blank_line (ROW(row), col, num, rstyle); |
1230 | scr_blank_line (line, col, num, rstyle); |
1219 | } |
1231 | } |
1220 | |
1232 | |
1221 | /* ------------------------------------------------------------------------- */ |
1233 | /* ------------------------------------------------------------------------- */ |
1222 | /* |
1234 | /* |
1223 | * Erase part of whole of the screen |
1235 | * Erase part of whole of the screen |
… | |
… | |
1278 | CLEAR_ROWS (row, num); |
1290 | CLEAR_ROWS (row, num); |
1279 | } |
1291 | } |
1280 | else |
1292 | else |
1281 | { |
1293 | { |
1282 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1294 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1283 | gcvalue.foreground = pix_colors[GET_BGCOLOR (rstyle)]; |
1295 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1284 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1296 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1285 | ERASE_ROWS (row, num); |
1297 | ERASE_ROWS (row, num); |
1286 | gcvalue.foreground = pix_colors[Color_fg]; |
1298 | gcvalue.foreground = pix_colors[Color_fg]; |
1287 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1299 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1288 | } |
1300 | } |
1289 | |
1301 | |
1290 | for (; num--; row++) |
1302 | for (; num--; row++) |
1291 | { |
1303 | { |
|
|
1304 | ROW (row).l = 0; |
1292 | scr_blank_screen_mem (ROW (row), rstyle); |
1305 | scr_blank_screen_mem (ROW (row), rstyle); |
1293 | ROW (row).l = 0; |
|
|
1294 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1306 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1295 | } |
1307 | } |
1296 | } |
1308 | } |
1297 | |
1309 | |
1298 | #if ENABLE_FRILLS |
1310 | #if ENABLE_FRILLS |
… | |
… | |
1587 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1599 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1588 | #if XPM_BACKGROUND |
1600 | #if XPM_BACKGROUND |
1589 | if (bgPixmap.pixmap == None) |
1601 | if (bgPixmap.pixmap == None) |
1590 | #endif |
1602 | #endif |
1591 | #if TRANSPARENT |
1603 | #if TRANSPARENT |
1592 | if (! (options & Opt_transparent) || am_transparent == 0) |
1604 | if (! OPTION (Opt_transparent) || am_transparent == 0) |
1593 | #endif |
1605 | #endif |
1594 | XSetWindowBackground (display->display, vt, |
1606 | XSetWindowBackground (display->display, vt, |
1595 | pix_colors[Color_bg]); |
1607 | pix_colors[Color_bg]); |
1596 | |
1608 | |
1597 | gcvalue.foreground = pix_colors[Color_fg]; |
1609 | gcvalue.foreground = pix_colors[Color_fg]; |
… | |
… | |
1813 | } |
1825 | } |
1814 | |
1826 | |
1815 | int |
1827 | int |
1816 | rxvt_term::scr_changeview (unsigned int oldviewstart) |
1828 | rxvt_term::scr_changeview (unsigned int oldviewstart) |
1817 | { |
1829 | { |
|
|
1830 | PERL_INVOKE ((this, HOOK_VIEW_CHANGE, DT_INT, view_start, DT_END)); |
|
|
1831 | |
1818 | if (view_start != oldviewstart) |
1832 | if (view_start != oldviewstart) |
1819 | { |
1833 | { |
1820 | want_refresh = 1; |
1834 | want_refresh = 1; |
1821 | num_scr -= (view_start - oldviewstart); |
1835 | num_scr -= (view_start - oldviewstart); |
1822 | } |
1836 | } |
… | |
… | |
1830 | { |
1844 | { |
1831 | #ifndef NO_BELL |
1845 | #ifndef NO_BELL |
1832 | |
1846 | |
1833 | # ifndef NO_MAPALERT |
1847 | # ifndef NO_MAPALERT |
1834 | # ifdef MAPALERT_OPTION |
1848 | # ifdef MAPALERT_OPTION |
1835 | if (options & Opt_mapAlert) |
1849 | if (OPTION (Opt_mapAlert)) |
1836 | # endif |
1850 | # endif |
1837 | XMapWindow (display->display, parent[0]); |
1851 | XMapWindow (display->display, parent[0]); |
1838 | # endif |
1852 | # endif |
1839 | |
1853 | |
1840 | if (options & Opt_visualBell) |
1854 | if (OPTION (Opt_visualBell)) |
1841 | { |
1855 | { |
1842 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1856 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1843 | rxvt_usleep (VISUAL_BELL_DURATION); |
1857 | rxvt_usleep (VISUAL_BELL_DURATION); |
1844 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1858 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1845 | } |
1859 | } |
… | |
… | |
1936 | |
1950 | |
1937 | #if XPM_BACKGROUND |
1951 | #if XPM_BACKGROUND |
1938 | must_clear |= bgPixmap.pixmap != None; |
1952 | must_clear |= bgPixmap.pixmap != None; |
1939 | #endif |
1953 | #endif |
1940 | #if TRANSPARENT |
1954 | #if TRANSPARENT |
1941 | must_clear |= (options & Opt_transparent) && am_transparent; |
1955 | must_clear |= OPTION (Opt_transparent) && am_transparent; |
1942 | #endif |
1956 | #endif |
1943 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
1957 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
1944 | |
1958 | |
1945 | /* |
1959 | /* |
1946 | * B: reverse any characters which are selected |
1960 | * B: reverse any characters which are selected |
… | |
… | |
1970 | |
1984 | |
1971 | crp = &ROW(screen.cur.row).r[col]; |
1985 | crp = &ROW(screen.cur.row).r[col]; |
1972 | |
1986 | |
1973 | if (showcursor && focus) |
1987 | if (showcursor && focus) |
1974 | { |
1988 | { |
1975 | if (options & Opt_cursorUnderline) |
1989 | if (OPTION (Opt_cursorUnderline)) |
1976 | *crp ^= RS_Uline; |
1990 | *crp ^= RS_Uline; |
1977 | else |
1991 | else |
1978 | { |
1992 | { |
1979 | *crp ^= RS_RVid; |
1993 | *crp ^= RS_RVid; |
1980 | |
1994 | |
… | |
… | |
1982 | cc1 = *crp & (RS_fgMask | RS_bgMask); |
1996 | cc1 = *crp & (RS_fgMask | RS_bgMask); |
1983 | if (ISSET_PIXCOLOR (Color_cursor)) |
1997 | if (ISSET_PIXCOLOR (Color_cursor)) |
1984 | ccol1 = Color_cursor; |
1998 | ccol1 = Color_cursor; |
1985 | else |
1999 | else |
1986 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
2000 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
1987 | ccol1 = GET_FGCOLOR (rstyle); |
2001 | ccol1 = fgcolor_of (rstyle); |
1988 | #else |
2002 | #else |
1989 | ccol1 = Color_fg; |
2003 | ccol1 = Color_fg; |
1990 | #endif |
2004 | #endif |
1991 | if (ISSET_PIXCOLOR (Color_cursor2)) |
2005 | if (ISSET_PIXCOLOR (Color_cursor2)) |
1992 | ccol2 = Color_cursor2; |
2006 | ccol2 = Color_cursor2; |
1993 | else |
2007 | else |
1994 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
2008 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
1995 | ccol2 = GET_BGCOLOR (rstyle); |
2009 | ccol2 = bgcolor_of (rstyle); |
1996 | #else |
2010 | #else |
1997 | ccol2 = Color_bg; |
2011 | ccol2 = Color_bg; |
1998 | #endif |
2012 | #endif |
1999 | *crp = SET_FGCOLOR (*crp, ccol1); |
2013 | *crp = SET_FGCOLOR (*crp, ccol1); |
2000 | *crp = SET_BGCOLOR (*crp, ccol2); |
2014 | *crp = SET_BGCOLOR (*crp, ccol2); |
… | |
… | |
2033 | oldcursor.col = screen.cur.col; |
2047 | oldcursor.col = screen.cur.col; |
2034 | } |
2048 | } |
2035 | } |
2049 | } |
2036 | } |
2050 | } |
2037 | |
2051 | |
|
|
2052 | PERL_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); |
2038 | #if ENABLE_OVERLAY |
2053 | #if ENABLE_OVERLAY |
2039 | scr_swap_overlay (); |
2054 | scr_swap_overlay (); |
2040 | #endif |
2055 | #endif |
2041 | |
2056 | |
2042 | #ifndef NO_SLOW_LINK_SUPPORT |
2057 | #ifndef NO_SLOW_LINK_SUPPORT |
… | |
… | |
2092 | if (wlen < len) |
2107 | if (wlen < len) |
2093 | ::swap (wlen, len); |
2108 | ::swap (wlen, len); |
2094 | |
2109 | |
2095 | XCopyArea (display->display, vt, vt, |
2110 | XCopyArea (display->display, vt, vt, |
2096 | gc, 0, Row2Pixel (len + i), |
2111 | gc, 0, Row2Pixel (len + i), |
2097 | (unsigned int)TermWin_TotalWidth (), |
2112 | (unsigned int)this->width, |
2098 | (unsigned int)Height2Pixel (wlen - len + 1), |
2113 | (unsigned int)Height2Pixel (wlen - len + 1), |
2099 | 0, Row2Pixel (len)); |
2114 | 0, Row2Pixel (len)); |
2100 | len = -1; |
2115 | len = -1; |
2101 | } |
2116 | } |
2102 | } |
2117 | } |
… | |
… | |
2181 | count++, i--; |
2196 | count++, i--; |
2182 | |
2197 | |
2183 | /* |
2198 | /* |
2184 | * Determine the attributes for the string |
2199 | * Determine the attributes for the string |
2185 | */ |
2200 | */ |
2186 | int fore = GET_FGCOLOR (rend); // desired foreground |
2201 | int fore = fgcolor_of (rend); // desired foreground |
2187 | int back = GET_BGCOLOR (rend); // desired background |
2202 | int back = bgcolor_of (rend); // desired background |
2188 | |
2203 | |
2189 | // only do special processing if any attributes are set, which is rare |
2204 | // only do special processing if any attributes are set, which is unlikely |
2190 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2205 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2191 | { |
2206 | { |
2192 | #if ENABLE_STYLES |
2207 | #if ENABLE_STYLES |
2193 | // force redraw after "careful" characters to avoid pixel droppings |
2208 | // force redraw after "careful" characters to avoid pixel droppings |
2194 | if (srp[col] & RS_Careful && col < ncol - 1 && 0) |
2209 | if (srp[col] & RS_Careful && col < ncol - 1 && 0) |
… | |
… | |
2305 | } /* for (row....) */ |
2320 | } /* for (row....) */ |
2306 | |
2321 | |
2307 | #if ENABLE_OVERLAY |
2322 | #if ENABLE_OVERLAY |
2308 | scr_swap_overlay (); |
2323 | scr_swap_overlay (); |
2309 | #endif |
2324 | #endif |
|
|
2325 | PERL_INVOKE ((this, HOOK_REFRESH_END, DT_END)); |
2310 | |
2326 | |
2311 | /* |
2327 | /* |
2312 | * G: cleanup cursor and display outline cursor if necessary |
2328 | * G: cleanup cursor and display outline cursor if necessary |
2313 | */ |
2329 | */ |
2314 | if (showcursor) |
2330 | if (showcursor) |
2315 | { |
2331 | { |
2316 | if (focus) |
2332 | if (focus) |
2317 | { |
2333 | { |
2318 | if (options & Opt_cursorUnderline) |
2334 | if (OPTION (Opt_cursorUnderline)) |
2319 | *crp ^= RS_Uline; |
2335 | *crp ^= RS_Uline; |
2320 | else |
2336 | else |
2321 | { |
2337 | { |
2322 | *crp ^= RS_RVid; |
2338 | *crp ^= RS_RVid; |
2323 | #ifndef NO_CURSORCOLOR |
2339 | #ifndef NO_CURSORCOLOR |
… | |
… | |
2442 | |
2458 | |
2443 | #if ENABLE_FRILLS |
2459 | #if ENABLE_FRILLS |
2444 | if (selection.rect) |
2460 | if (selection.rect) |
2445 | { |
2461 | { |
2446 | for (row = max (selection.beg.row, -view_start); row <= min (selection.end.row, view_end); row++) |
2462 | for (row = max (selection.beg.row, -view_start); row <= min (selection.end.row, view_end); row++) |
|
|
2463 | { |
|
|
2464 | text_t *stp = ROW(row).t; |
|
|
2465 | rend_t *srp = ROW(row).r; |
|
|
2466 | |
2447 | for (rend_t *srp = ROW(row).r, col = selection.beg.col; col < selection.end.col; col++) |
2467 | for (col = selection.beg.col; col < selection.end.col; col++) |
2448 | srp[col] ^= RS_RVid; |
2468 | srp[col] ^= RS_RVid; |
|
|
2469 | |
|
|
2470 | while (col-- > selection.beg.col && (stp[col] == NOCHAR || unicode::is_space (stp[col]))) |
|
|
2471 | srp[col] ^= RS_RVid | RS_Uline; |
|
|
2472 | |
|
|
2473 | if (++col < selection.end.col) |
|
|
2474 | srp[col] ^= RS_RVid | RS_Uline; |
|
|
2475 | } |
2449 | } |
2476 | } |
2450 | else |
2477 | else |
2451 | #endif |
2478 | #endif |
2452 | { |
2479 | { |
2453 | if (selection.beg.row >= -view_start) |
2480 | if (selection.beg.row >= -view_start) |
… | |
… | |
2456 | row = selection.beg.row; |
2483 | row = selection.beg.row; |
2457 | } |
2484 | } |
2458 | else |
2485 | else |
2459 | { |
2486 | { |
2460 | col = 0; |
2487 | col = 0; |
2461 | row = view_start; |
2488 | row = -view_start; |
2462 | } |
2489 | } |
2463 | |
2490 | |
2464 | for (; row < min (selection.end.row, view_end); row++, col = 0) |
2491 | for (; row < min (selection.end.row, view_end); row++, col = 0) |
2465 | for (rend_t *srp = ROW(row).r; col < ncol; col++) |
2492 | for (rend_t *srp = ROW(row).r; col < ncol; col++) |
2466 | srp[col] ^= RS_RVid; |
2493 | srp[col] ^= RS_RVid; |
… | |
… | |
2537 | /* ------------------------------------------------------------------------- */ |
2564 | /* ------------------------------------------------------------------------- */ |
2538 | /* |
2565 | /* |
2539 | * Paste a selection direct to the command fd |
2566 | * Paste a selection direct to the command fd |
2540 | */ |
2567 | */ |
2541 | void |
2568 | void |
2542 | rxvt_term::paste (unsigned char *data, unsigned int len) |
2569 | rxvt_term::paste (char *data, unsigned int len) |
2543 | { |
2570 | { |
2544 | /* convert normal newline chars into common keyboard Return key sequence */ |
2571 | /* convert normal newline chars into common keyboard Return key sequence */ |
2545 | for (unsigned int i = 0; i < len; i++) |
2572 | for (unsigned int i = 0; i < len; i++) |
2546 | if (data[i] == C0_LF) |
2573 | if (data[i] == C0_LF) |
2547 | data[i] = C0_CR; |
2574 | data[i] = C0_CR; |
… | |
… | |
2691 | { |
2718 | { |
2692 | wchar_t *w = rxvt_utf8towcs ((const char *)ct.value, ct.nitems); |
2719 | wchar_t *w = rxvt_utf8towcs ((const char *)ct.value, ct.nitems); |
2693 | char *s = rxvt_wcstombs (w); |
2720 | char *s = rxvt_wcstombs (w); |
2694 | free (w); |
2721 | free (w); |
2695 | // TODO: strlen == only the first element will be converted. well... |
2722 | // TODO: strlen == only the first element will be converted. well... |
2696 | paste ((unsigned char *)s, strlen (s)); |
2723 | paste (s, strlen (s)); |
2697 | free (s); |
2724 | free (s); |
2698 | } |
2725 | } |
2699 | else |
2726 | else |
2700 | #endif |
2727 | #endif |
2701 | if (XmbTextPropertyToTextList (display->display, &ct, &cl, &cr) >= 0 |
2728 | if (XmbTextPropertyToTextList (display->display, &ct, &cl, &cr) >= 0 |
2702 | && cl) |
2729 | && cl) |
2703 | { |
2730 | { |
2704 | for (int i = 0; i < cr; i++) |
2731 | for (int i = 0; i < cr; i++) |
2705 | paste ((unsigned char *)cl[i], strlen (cl[i])); |
2732 | paste (cl[i], strlen (cl[i])); |
2706 | |
2733 | |
2707 | XFreeStringList (cl); |
2734 | XFreeStringList (cl); |
2708 | } |
2735 | } |
2709 | else |
2736 | else |
2710 | paste (ct.value, ct.nitems); // paste raw |
2737 | paste ((char *)ct.value, ct.nitems); // paste raw |
2711 | |
2738 | |
2712 | bailout: |
2739 | bailout: |
2713 | XFree (ct.value); |
2740 | XFree (ct.value); |
2714 | |
2741 | |
2715 | if (selection_wait == Sel_normal) |
2742 | if (selection_wait == Sel_normal) |
… | |
… | |
2753 | return; /* outside window */ |
2780 | return; /* outside window */ |
2754 | |
2781 | |
2755 | if (selection.text) |
2782 | if (selection.text) |
2756 | { /* internal selection */ |
2783 | { /* internal selection */ |
2757 | char *str = rxvt_wcstombs (selection.text, selection.len); |
2784 | char *str = rxvt_wcstombs (selection.text, selection.len); |
2758 | paste ((unsigned char *)str, strlen (str)); |
2785 | paste (str, strlen (str)); |
2759 | free (str); |
2786 | free (str); |
2760 | return; |
2787 | return; |
2761 | } |
2788 | } |
2762 | else |
2789 | else |
2763 | { |
2790 | { |
… | |
… | |
2855 | selection.op = SELECTION_DONE; |
2882 | selection.op = SELECTION_DONE; |
2856 | |
2883 | |
2857 | if (selection.clicks == 4) |
2884 | if (selection.clicks == 4) |
2858 | return; /* nothing selected, go away */ |
2885 | return; /* nothing selected, go away */ |
2859 | |
2886 | |
|
|
2887 | if (PERL_INVOKE ((this, HOOK_SEL_MAKE, DT_LONG, (long)tm, DT_END))) |
|
|
2888 | return; |
|
|
2889 | |
2860 | i = (selection.end.row - selection.beg.row + 1) * (ncol + 1); |
2890 | i = (selection.end.row - selection.beg.row + 1) * (ncol + 1); |
2861 | new_selection_text = (wchar_t *)rxvt_malloc ((i + 4) * sizeof (wchar_t)); |
2891 | new_selection_text = (wchar_t *)rxvt_malloc ((i + 4) * sizeof (wchar_t)); |
2862 | |
2892 | |
2863 | int ofs = 0; |
2893 | int ofs = 0; |
2864 | int extra = 0; |
2894 | int extra = 0; |
… | |
… | |
2880 | #endif |
2910 | #endif |
2881 | end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN |
2911 | end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN |
2882 | |
2912 | |
2883 | col = max (col, 0); |
2913 | col = max (col, 0); |
2884 | |
2914 | |
2885 | if (row == selection.end.row || selection.rect) |
2915 | if (row == selection.end.row |
|
|
2916 | #if ENABLE_FRILLS |
|
|
2917 | || selection.rect |
|
|
2918 | #endif |
|
|
2919 | ) |
2886 | end_col = min (end_col, selection.end.col); |
2920 | min_it (end_col, selection.end.col); |
2887 | |
2921 | |
2888 | t = ROW(row).t + col; |
2922 | t = ROW(row).t + col; |
2889 | for (; col < end_col; col++) |
2923 | for (; col < end_col; col++) |
2890 | { |
2924 | { |
2891 | if (*t == NOCHAR) |
2925 | if (*t == NOCHAR) |
… | |
… | |
2909 | #endif |
2943 | #endif |
2910 | else |
2944 | else |
2911 | new_selection_text[ofs++] = *t++; |
2945 | new_selection_text[ofs++] = *t++; |
2912 | } |
2946 | } |
2913 | |
2947 | |
|
|
2948 | #if ENABLE_FRILLS |
|
|
2949 | if (selection.rect) |
|
|
2950 | { |
|
|
2951 | while (ofs |
|
|
2952 | && new_selection_text[ofs - 1] != C0_LF |
|
|
2953 | && unicode::is_space (new_selection_text[ofs - 1])) |
|
|
2954 | --ofs; |
|
|
2955 | |
|
|
2956 | new_selection_text[ofs++] = C0_LF; |
|
|
2957 | } |
|
|
2958 | else |
|
|
2959 | #endif |
2914 | if (!ROW(row).is_longer () && row != selection.end.row) |
2960 | if (!ROW(row).is_longer () && row != selection.end.row) |
2915 | new_selection_text[ofs++] = C0_LF; |
2961 | new_selection_text[ofs++] = C0_LF; |
2916 | } |
2962 | } |
2917 | |
2963 | |
2918 | if (end_col != selection.end.col) |
2964 | if (end_col != selection.end.col) |
2919 | new_selection_text[ofs++] = C0_LF; |
2965 | new_selection_text[ofs++] = C0_LF; |
2920 | |
2966 | |
… | |
… | |
2930 | |
2976 | |
2931 | // we usually allocate much more than necessary, so realloc it smaller again |
2977 | // we usually allocate much more than necessary, so realloc it smaller again |
2932 | selection.len = ofs; |
2978 | selection.len = ofs; |
2933 | selection.text = (wchar_t *)rxvt_realloc (new_selection_text, (ofs + 1) * sizeof (wchar_t)); |
2979 | selection.text = (wchar_t *)rxvt_realloc (new_selection_text, (ofs + 1) * sizeof (wchar_t)); |
2934 | |
2980 | |
|
|
2981 | if (PERL_INVOKE ((this, HOOK_SEL_GRAB, DT_LONG, (long)tm, DT_END))) |
|
|
2982 | return; |
|
|
2983 | |
|
|
2984 | selection_grab (tm); |
|
|
2985 | } |
|
|
2986 | |
|
|
2987 | bool |
|
|
2988 | rxvt_term::selection_grab (Time tm) |
|
|
2989 | { |
|
|
2990 | selection_time = tm; |
|
|
2991 | |
2935 | XSetSelectionOwner (display->display, XA_PRIMARY, vt, tm); |
2992 | XSetSelectionOwner (display->display, XA_PRIMARY, vt, tm); |
2936 | if (XGetSelectionOwner (display->display, XA_PRIMARY) == vt) |
2993 | if (XGetSelectionOwner (display->display, XA_PRIMARY) == vt) |
|
|
2994 | { |
2937 | display->set_selection_owner (this); |
2995 | display->set_selection_owner (this); |
|
|
2996 | return true; |
|
|
2997 | } |
2938 | else |
2998 | else |
2939 | rxvt_warn ("can't get primary selection, ignoring.\n"); |
2999 | return false; |
2940 | |
3000 | |
2941 | #if 0 |
3001 | #if 0 |
2942 | XTextProperty ct; |
3002 | XTextProperty ct; |
2943 | |
3003 | |
2944 | if (XwcTextListToTextProperty (display->display, &selection.text, 1, XStringStyle, &ct) >= 0) |
3004 | if (XwcTextListToTextProperty (display->display, &selection.text, 1, XStringStyle, &ct) >= 0) |
2945 | { |
3005 | { |
2946 | set_string_property (XA_CUT_BUFFER0, ct.value, ct.nitems); |
3006 | set_string_property (XA_CUT_BUFFER0, ct.value, ct.nitems); |
2947 | XFree (ct.value); |
3007 | XFree (ct.value); |
2948 | } |
3008 | } |
2949 | #endif |
3009 | #endif |
2950 | |
|
|
2951 | selection_time = tm; |
|
|
2952 | } |
3010 | } |
2953 | |
3011 | |
2954 | /* ------------------------------------------------------------------------- */ |
3012 | /* ------------------------------------------------------------------------- */ |
2955 | /* |
3013 | /* |
2956 | * Mark or select text based upon number of clicks: 1, 2, or 3 |
3014 | * Mark or select text based upon number of clicks: 1, 2, or 3 |
… | |
… | |
3265 | else if (selection.clicks == 2) |
3323 | else if (selection.clicks == 2) |
3266 | { |
3324 | { |
3267 | if (ROWCOL_IS_AFTER (selection.end, selection.beg)) |
3325 | if (ROWCOL_IS_AFTER (selection.end, selection.beg)) |
3268 | selection.end.col--; |
3326 | selection.end.col--; |
3269 | |
3327 | |
|
|
3328 | if (!PERL_INVOKE ((this, HOOK_SEL_EXTEND, DT_END))) |
|
|
3329 | { |
3270 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3330 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3271 | selection_delimit_word (DN, &selection.end, &selection.end); |
3331 | selection_delimit_word (DN, &selection.end, &selection.end); |
|
|
3332 | } |
3272 | } |
3333 | } |
3273 | else if (selection.clicks == 3) |
3334 | else if (selection.clicks == 3) |
3274 | { |
3335 | { |
3275 | #if ENABLE_FRILLS |
3336 | #if ENABLE_FRILLS |
3276 | if (options & Opt_tripleclickwords) |
3337 | if (OPTION (Opt_tripleclickwords)) |
3277 | { |
3338 | { |
3278 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3339 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3279 | |
3340 | |
3280 | for (int end_row = selection.mark.row; end_row < nrow; end_row++) |
3341 | for (int end_row = selection.mark.row; end_row < nrow; end_row++) |
3281 | { |
3342 | { |
… | |
… | |
3342 | { |
3403 | { |
3343 | stp = ROW(end_row).t; |
3404 | stp = ROW(end_row).t; |
3344 | |
3405 | |
3345 | while (--end_col >= 0) |
3406 | while (--end_col >= 0) |
3346 | { |
3407 | { |
3347 | if (stp[end_col] != ' ' |
3408 | if (stp[end_col] != NOCHAR |
3348 | && stp[end_col] != '\t' |
3409 | && !unicode::is_space (stp[end_col])) |
3349 | && stp[end_col] != NOCHAR) |
|
|
3350 | break; |
3410 | break; |
3351 | } |
3411 | } |
3352 | |
3412 | |
3353 | if (end_col >= 0 |
3413 | if (end_col >= 0 |
3354 | || !ROW(end_row - 1).is_longer ()) |
3414 | || !ROW(end_row - 1).is_longer ()) |
… | |
… | |
3553 | |
3613 | |
3554 | #if ENABLE_OVERLAY |
3614 | #if ENABLE_OVERLAY |
3555 | void |
3615 | void |
3556 | rxvt_term::scr_overlay_new (int x, int y, int w, int h) |
3616 | rxvt_term::scr_overlay_new (int x, int y, int w, int h) |
3557 | { |
3617 | { |
3558 | if (nrow < 3 || ncol < 3) |
3618 | if (nrow < 1 || ncol < 1) |
3559 | return; |
3619 | return; |
3560 | |
3620 | |
3561 | want_refresh = 1; |
3621 | want_refresh = 1; |
3562 | |
3622 | |
3563 | scr_overlay_off (); |
3623 | scr_overlay_off (); |
… | |
… | |
3670 | for (int y = ov_h; y--; ) |
3730 | for (int y = ov_h; y--; ) |
3671 | { |
3731 | { |
3672 | text_t *t1 = ov_text[y]; |
3732 | text_t *t1 = ov_text[y]; |
3673 | rend_t *r1 = ov_rend[y]; |
3733 | rend_t *r1 = ov_rend[y]; |
3674 | |
3734 | |
3675 | text_t *t2 = ROW(y - view_start).t + ov_x; |
3735 | text_t *t2 = ROW(y + ov_y - view_start).t + ov_x; |
3676 | rend_t *r2 = ROW(y - view_start).r + ov_x; |
3736 | rend_t *r2 = ROW(y + ov_y - view_start).r + ov_x; |
3677 | |
3737 | |
3678 | for (int x = ov_w; x--; ) |
3738 | for (int x = ov_w; x--; ) |
3679 | { |
3739 | { |
3680 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3740 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3681 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |
3741 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |