… | |
… | |
46 | |
46 | |
47 | /* ------------------------------------------------------------------------- * |
47 | /* ------------------------------------------------------------------------- * |
48 | * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * |
48 | * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * |
49 | * ------------------------------------------------------------------------- */ |
49 | * ------------------------------------------------------------------------- */ |
50 | #define ZERO_SCROLLBACK() \ |
50 | #define ZERO_SCROLLBACK() \ |
51 | if (options & Opt_scrollTtyOutput) \ |
51 | if (OPTION (Opt_scrollTtyOutput)) \ |
52 | view_start = 0 |
52 | view_start = 0 |
53 | #define CLEAR_SELECTION() \ |
53 | #define CLEAR_SELECTION() \ |
54 | selection.beg.row = selection.beg.col \ |
54 | selection.beg.row = selection.beg.col \ |
55 | = selection.end.row = selection.end.col = 0 |
55 | = selection.end.row = selection.end.col = 0 |
56 | #define CLEAR_ALL_SELECTION() \ |
56 | #define CLEAR_ALL_SELECTION() \ |
… | |
… | |
351 | lofs += len; |
351 | lofs += len; |
352 | qcol += len; |
352 | qcol += len; |
353 | } |
353 | } |
354 | } |
354 | } |
355 | |
355 | |
356 | qline->l = llen < ncol ? llen : MOD (llen - 1, ncol) + 1; |
356 | qline->l = llen ? MOD (llen - 1, ncol) + 1 : 0; |
|
|
357 | #ifdef DEBUG_STRICT //TODO//FIXME//TEMPORARY |
|
|
358 | if (qline->l < 0) |
|
|
359 | { |
|
|
360 | 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 |
|
|
361 | qline->l = 0; |
|
|
362 | } |
|
|
363 | #endif |
357 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
364 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
358 | } |
365 | } |
359 | while (p != pend && q > 0); |
366 | while (p != pend && q > 0); |
360 | |
367 | |
361 | term_start = total_rows - nrow; |
368 | term_start = total_rows - nrow; |
… | |
… | |
385 | } |
392 | } |
386 | |
393 | |
387 | term_start = 0; |
394 | term_start = 0; |
388 | } |
395 | } |
389 | |
396 | |
390 | #ifdef DEBUG_STRICT |
397 | #ifdef DEBUG_STRICT //TODO: remove |
391 | for (int i = -nsaved; i < nrow; i++) |
398 | for (int i = -nsaved; i < nrow; i++) |
392 | assert (ROW (i).t); |
399 | assert (ROW (i).t); |
393 | #endif |
400 | #endif |
394 | |
401 | |
395 | free (old_buf); |
402 | free (old_buf); |
… | |
… | |
523 | |
530 | |
524 | screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); |
531 | screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); |
525 | screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); |
532 | screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); |
526 | |
533 | |
527 | #if NSCREENS |
534 | #if NSCREENS |
528 | if (options & Opt_secondaryScreen) |
535 | if (OPTION (Opt_secondaryScreen)) |
529 | { |
536 | { |
530 | num_scr = 0; |
537 | num_scr = 0; |
531 | |
538 | |
532 | for (int i = prev_nrow; i--; ) |
539 | for (int i = prev_nrow; i--; ) |
533 | ::swap (ROW(i), swap_buf [i]); |
540 | ::swap (ROW(i), swap_buf [i]); |
… | |
… | |
537 | screen.flags |= Screen_VisibleCursor; |
544 | screen.flags |= Screen_VisibleCursor; |
538 | swap.flags |= Screen_VisibleCursor; |
545 | swap.flags |= Screen_VisibleCursor; |
539 | } |
546 | } |
540 | else |
547 | else |
541 | #endif |
548 | #endif |
542 | if (options & Opt_secondaryScroll) |
549 | if (OPTION (Opt_secondaryScroll)) |
543 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
550 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
544 | |
551 | |
545 | return scrn; |
552 | return scrn; |
546 | } |
553 | } |
547 | |
554 | |
… | |
… | |
609 | num_scr += count; |
616 | num_scr += count; |
610 | |
617 | |
611 | if (count > 0 |
618 | if (count > 0 |
612 | && row1 == 0 |
619 | && row1 == 0 |
613 | && row2 == nrow - 1 |
620 | && row2 == nrow - 1 |
614 | && (current_screen == PRIMARY || options & Opt_secondaryScroll)) |
621 | && (current_screen == PRIMARY || OPTION (Opt_secondaryScroll))) |
615 | { |
622 | { |
616 | nsaved = min (nsaved + count, saveLines); |
623 | nsaved = min (nsaved + count, saveLines); |
617 | term_start = (term_start + count) % total_rows; |
624 | term_start = (term_start + count) % total_rows; |
618 | |
625 | |
619 | if (selection.op && current_screen == selection.screen) |
626 | if (selection.op && current_screen == selection.screen) |
620 | { |
627 | { |
621 | selection.beg.row -= count; |
628 | selection.beg.row -= count; |
622 | selection.end.row -= count; |
629 | selection.end.row -= count; |
623 | selection.mark.row -= count; |
630 | selection.mark.row -= count; |
624 | |
631 | |
625 | selection_check (0); |
632 | if (selection.beg.row < -nsaved |
|
|
633 | || selection.end.row < -nsaved |
|
|
634 | || selection.mark.row < -nsaved) |
|
|
635 | { |
|
|
636 | CLEAR_ALL_SELECTION (); |
|
|
637 | selection.op = SELECTION_CLEAR; |
|
|
638 | } |
626 | } |
639 | } |
627 | |
640 | |
628 | for (int i = count; i--; ) |
641 | for (int i = count; i--; ) |
|
|
642 | { |
|
|
643 | ROW(row2 - i).l = 0; |
629 | scr_blank_screen_mem (ROW(row2 - i), rstyle); |
644 | scr_blank_screen_mem (ROW(row2 - i), rstyle); |
|
|
645 | } |
630 | |
646 | |
631 | if ((options & Opt_scrollWithBuffer) |
647 | if (OPTION (Opt_scrollWithBuffer) |
632 | && view_start != 0 |
648 | && view_start != 0 |
633 | && view_start != saveLines) |
649 | && view_start != saveLines) |
634 | scr_page (UP, count); |
650 | scr_page (UP, count); |
635 | } |
651 | } |
636 | else |
652 | else |
637 | { |
653 | { |
638 | if (selection.op && current_screen == selection.screen) |
654 | if (selection.op && current_screen == selection.screen) |
639 | { |
655 | { |
640 | int i = selection.beg.row; |
656 | if ((selection.beg.row < row1 && selection.end.row > row1) |
641 | int j = selection.end.row; |
657 | || (selection.beg.row < row2 && selection.end.row > row2) |
642 | |
|
|
643 | if ((i < row1 && j > row1) |
|
|
644 | || (i < row2 && j > row2) |
|
|
645 | || (i - count < row1 && i >= row1) |
658 | || (selection.beg.row - count < row1 && selection.beg.row >= row1) |
646 | || (i - count > row2 && i <= row2) |
659 | || (selection.beg.row - count > row2 && selection.beg.row <= row2) |
647 | || (j - count < row1 && j >= row1) |
660 | || (selection.end.row - count < row1 && selection.end.row >= row1) |
648 | || (j - count > row2 && j <= row2)) |
661 | || (selection.end.row - count > row2 && selection.end.row <= row2)) |
649 | { |
662 | { |
650 | CLEAR_ALL_SELECTION (); |
663 | CLEAR_ALL_SELECTION (); |
651 | selection.op = SELECTION_CLEAR; /* XXX: too aggressive? */ |
664 | selection.op = SELECTION_CLEAR; |
652 | } |
665 | } |
653 | else if (j >= row1 && j <= row2) |
666 | else if (selection.end.row >= row1 && selection.end.row <= row2) |
654 | { |
667 | { |
655 | /* move selected region too */ |
668 | /* move selected region too */ |
656 | selection.beg.row -= count; |
669 | selection.beg.row -= count; |
657 | selection.end.row -= count; |
670 | selection.end.row -= count; |
658 | selection.mark.row -= count; |
671 | selection.mark.row -= count; |
… | |
… | |
693 | if (len <= 0) /* sanity */ |
706 | if (len <= 0) /* sanity */ |
694 | return; |
707 | return; |
695 | |
708 | |
696 | unsigned char checksel; |
709 | unsigned char checksel; |
697 | unicode_t c; |
710 | unicode_t c; |
698 | int row, last_col; |
711 | int last_col; |
699 | const unicode_t *strend = str + len; |
712 | const unicode_t *strend = str + len; |
700 | |
713 | |
701 | want_refresh = 1; |
714 | want_refresh = 1; |
702 | ZERO_SCROLLBACK (); |
715 | ZERO_SCROLLBACK (); |
703 | last_col = ncol; |
716 | last_col = ncol; |
… | |
… | |
718 | #ifdef DEBUG_STRICT |
731 | #ifdef DEBUG_STRICT |
719 | assert (screen.cur.col < last_col); |
732 | assert (screen.cur.col < last_col); |
720 | assert (screen.cur.row < nrow |
733 | assert (screen.cur.row < nrow |
721 | && screen.cur.row >= -nsaved); |
734 | && screen.cur.row >= -nsaved); |
722 | #endif |
735 | #endif |
723 | row = screen.cur.row; |
736 | int row = screen.cur.row; |
724 | |
737 | |
725 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
738 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
726 | |
739 | |
727 | line_t *line = &ROW(row); |
740 | line_t *line = &ROW(row); |
728 | |
741 | |
… | |
… | |
730 | { |
743 | { |
731 | c = *str++; |
744 | c = *str++; |
732 | |
745 | |
733 | if (c < 0x20) |
746 | if (c < 0x20) |
734 | if (c == C0_LF) |
747 | if (c == C0_LF) |
735 | { |
748 | { |
736 | if (!line->is_longer ()) /* XXX: think about this */ |
749 | if (!line->is_longer ()) /* XXX: think about this */ |
737 | max_it (line->l, screen.cur.col); |
750 | max_it (line->l, screen.cur.col); |
738 | |
751 | |
739 | screen.flags &= ~Screen_WrapNext; |
752 | screen.flags &= ~Screen_WrapNext; |
740 | |
753 | |
… | |
… | |
985 | |
998 | |
986 | if (count == 0) |
999 | if (count == 0) |
987 | return; |
1000 | return; |
988 | else if (count > 0) |
1001 | else if (count > 0) |
989 | { |
1002 | { |
990 | int row = screen.cur.row; |
|
|
991 | |
|
|
992 | line_t &l = ROW(row); |
1003 | line_t &l = ROW(screen.cur.row); |
993 | rend_t base_rend = l.r[i]; |
1004 | rend_t base_rend = l.r[i]; |
994 | ht &= l.t[i] == ' '; |
1005 | ht &= l.t[i] == ' '; |
995 | |
1006 | |
996 | for (; ++i < ncol; ) |
1007 | for (; ++i < ncol; ) |
997 | if (tabs[i]) |
1008 | if (tabs[i]) |
… | |
… | |
1007 | if (count) |
1018 | if (count) |
1008 | x = ncol - 1; |
1019 | x = ncol - 1; |
1009 | |
1020 | |
1010 | // store horizontal tab commands as characters inside the text |
1021 | // store horizontal tab commands as characters inside the text |
1011 | // buffer so they can be selected and pasted. |
1022 | // buffer so they can be selected and pasted. |
1012 | if (ht && options & Opt_pastableTabs) |
1023 | if (ht && OPTION (Opt_pastableTabs)) |
1013 | { |
1024 | { |
1014 | base_rend = SET_FONT (base_rend, 0); |
1025 | base_rend = SET_FONT (base_rend, 0); |
1015 | |
1026 | |
1016 | if (!l.is_longer ()) /* XXX: think about this */ |
1027 | if (!l.is_longer ()) /* XXX: think about this */ |
1017 | max_it (l.l, x); |
1028 | max_it (l.l, x); |
… | |
… | |
1072 | */ |
1083 | */ |
1073 | #if ENABLE_FRILLS |
1084 | #if ENABLE_FRILLS |
1074 | void |
1085 | void |
1075 | rxvt_term::scr_forwardindex () |
1086 | rxvt_term::scr_forwardindex () |
1076 | { |
1087 | { |
1077 | int row; |
|
|
1078 | |
|
|
1079 | if (screen.cur.col < ncol - 1) |
1088 | if (screen.cur.col < ncol - 1) |
1080 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1089 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1081 | else |
1090 | else |
1082 | { |
1091 | { |
1083 | row = screen.cur.row; |
|
|
1084 | |
|
|
1085 | if (ROW(row).is_longer ()) //TODO//FIXME//LEN |
1092 | if (ROW(screen.cur.row).is_longer ()) //TODO//FIXME//LEN |
1086 | ROW(row).l = ncol; |
1093 | ROW(screen.cur.row).l = ncol; |
1087 | |
1094 | |
1088 | scr_gotorc (0, 0, R_RELATIVE); |
1095 | scr_gotorc (0, 0, R_RELATIVE); |
1089 | scr_insdel_chars (1, DELETE); |
1096 | scr_insdel_chars (1, DELETE); |
1090 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1097 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1091 | } |
1098 | } |
… | |
… | |
1174 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1181 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1175 | */ |
1182 | */ |
1176 | void |
1183 | void |
1177 | rxvt_term::scr_erase_line (int mode) |
1184 | rxvt_term::scr_erase_line (int mode) |
1178 | { |
1185 | { |
1179 | unsigned int row, col, num; |
1186 | unsigned int col, num; |
1180 | |
1187 | |
1181 | want_refresh = 1; |
1188 | want_refresh = 1; |
1182 | ZERO_SCROLLBACK (); |
1189 | ZERO_SCROLLBACK (); |
1183 | |
1190 | |
1184 | selection_check (1); |
1191 | selection_check (1); |
1185 | |
1192 | |
1186 | row = screen.cur.row; |
1193 | line_t &line = ROW(screen.cur.row); |
1187 | |
1194 | |
1188 | switch (mode) |
1195 | switch (mode) |
1189 | { |
1196 | { |
1190 | case 0: /* erase to end of line */ |
1197 | case 0: /* erase to end of line */ |
1191 | col = screen.cur.col; |
1198 | col = screen.cur.col; |
1192 | num = ncol - col; |
1199 | num = ncol - col; |
1193 | min_it (ROW(row).l, col); |
1200 | min_it (line.l, col); |
1194 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1201 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1195 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1202 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1196 | CLEAR_SELECTION (); |
1203 | CLEAR_SELECTION (); |
1197 | break; |
1204 | break; |
1198 | case 1: /* erase to beginning of line */ |
1205 | case 1: /* erase to beginning of line */ |
… | |
… | |
1203 | CLEAR_SELECTION (); |
1210 | CLEAR_SELECTION (); |
1204 | break; |
1211 | break; |
1205 | case 2: /* erase whole line */ |
1212 | case 2: /* erase whole line */ |
1206 | col = 0; |
1213 | col = 0; |
1207 | num = ncol; |
1214 | num = ncol; |
1208 | ROW(row).l = 0; |
1215 | line.l = 0; |
1209 | if (selection.beg.row <= screen.cur.row |
1216 | if (selection.beg.row <= screen.cur.row |
1210 | && selection.end.row >= screen.cur.row) |
1217 | && selection.end.row >= screen.cur.row) |
1211 | CLEAR_SELECTION (); |
1218 | CLEAR_SELECTION (); |
1212 | break; |
1219 | break; |
1213 | default: |
1220 | default: |
1214 | return; |
1221 | return; |
1215 | } |
1222 | } |
1216 | |
1223 | |
1217 | scr_blank_line (ROW(row), col, num, rstyle); |
1224 | scr_blank_line (line, col, num, rstyle); |
1218 | } |
1225 | } |
1219 | |
1226 | |
1220 | /* ------------------------------------------------------------------------- */ |
1227 | /* ------------------------------------------------------------------------- */ |
1221 | /* |
1228 | /* |
1222 | * Erase part of whole of the screen |
1229 | * Erase part of whole of the screen |
… | |
… | |
1277 | CLEAR_ROWS (row, num); |
1284 | CLEAR_ROWS (row, num); |
1278 | } |
1285 | } |
1279 | else |
1286 | else |
1280 | { |
1287 | { |
1281 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1288 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1282 | gcvalue.foreground = pix_colors[GET_BGCOLOR (rstyle)]; |
1289 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1283 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1290 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1284 | ERASE_ROWS (row, num); |
1291 | ERASE_ROWS (row, num); |
1285 | gcvalue.foreground = pix_colors[Color_fg]; |
1292 | gcvalue.foreground = pix_colors[Color_fg]; |
1286 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1293 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1287 | } |
1294 | } |
1288 | |
1295 | |
1289 | for (; num--; row++) |
1296 | for (; num--; row++) |
1290 | { |
1297 | { |
|
|
1298 | ROW (row).l = 0; |
1291 | scr_blank_screen_mem (ROW (row), rstyle); |
1299 | scr_blank_screen_mem (ROW (row), rstyle); |
1292 | ROW (row).l = 0; |
|
|
1293 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1300 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1294 | } |
1301 | } |
1295 | } |
1302 | } |
1296 | |
1303 | |
1297 | #if ENABLE_FRILLS |
1304 | #if ENABLE_FRILLS |
… | |
… | |
1586 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1593 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1587 | #if XPM_BACKGROUND |
1594 | #if XPM_BACKGROUND |
1588 | if (bgPixmap.pixmap == None) |
1595 | if (bgPixmap.pixmap == None) |
1589 | #endif |
1596 | #endif |
1590 | #if TRANSPARENT |
1597 | #if TRANSPARENT |
1591 | if (! (options & Opt_transparent) || am_transparent == 0) |
1598 | if (! OPTION (Opt_transparent) || am_transparent == 0) |
1592 | #endif |
1599 | #endif |
1593 | XSetWindowBackground (display->display, vt, |
1600 | XSetWindowBackground (display->display, vt, |
1594 | pix_colors[Color_bg]); |
1601 | pix_colors[Color_bg]); |
1595 | |
1602 | |
1596 | gcvalue.foreground = pix_colors[Color_fg]; |
1603 | gcvalue.foreground = pix_colors[Color_fg]; |
… | |
… | |
1829 | { |
1836 | { |
1830 | #ifndef NO_BELL |
1837 | #ifndef NO_BELL |
1831 | |
1838 | |
1832 | # ifndef NO_MAPALERT |
1839 | # ifndef NO_MAPALERT |
1833 | # ifdef MAPALERT_OPTION |
1840 | # ifdef MAPALERT_OPTION |
1834 | if (options & Opt_mapAlert) |
1841 | if (OPTION (Opt_mapAlert)) |
1835 | # endif |
1842 | # endif |
1836 | XMapWindow (display->display, parent[0]); |
1843 | XMapWindow (display->display, parent[0]); |
1837 | # endif |
1844 | # endif |
1838 | |
1845 | |
1839 | if (options & Opt_visualBell) |
1846 | if (OPTION (Opt_visualBell)) |
1840 | { |
1847 | { |
1841 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1848 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1842 | rxvt_usleep (VISUAL_BELL_DURATION); |
1849 | rxvt_usleep (VISUAL_BELL_DURATION); |
1843 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1850 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1844 | } |
1851 | } |
… | |
… | |
1935 | |
1942 | |
1936 | #if XPM_BACKGROUND |
1943 | #if XPM_BACKGROUND |
1937 | must_clear |= bgPixmap.pixmap != None; |
1944 | must_clear |= bgPixmap.pixmap != None; |
1938 | #endif |
1945 | #endif |
1939 | #if TRANSPARENT |
1946 | #if TRANSPARENT |
1940 | must_clear |= (options & Opt_transparent) && am_transparent; |
1947 | must_clear |= OPTION (Opt_transparent) && am_transparent; |
1941 | #endif |
1948 | #endif |
1942 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
1949 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
1943 | |
1950 | |
1944 | /* |
1951 | /* |
1945 | * B: reverse any characters which are selected |
1952 | * B: reverse any characters which are selected |
… | |
… | |
1969 | |
1976 | |
1970 | crp = &ROW(screen.cur.row).r[col]; |
1977 | crp = &ROW(screen.cur.row).r[col]; |
1971 | |
1978 | |
1972 | if (showcursor && focus) |
1979 | if (showcursor && focus) |
1973 | { |
1980 | { |
1974 | if (options & Opt_cursorUnderline) |
1981 | if (OPTION (Opt_cursorUnderline)) |
1975 | *crp ^= RS_Uline; |
1982 | *crp ^= RS_Uline; |
1976 | else |
1983 | else |
1977 | { |
1984 | { |
1978 | *crp ^= RS_RVid; |
1985 | *crp ^= RS_RVid; |
1979 | |
1986 | |
… | |
… | |
1981 | cc1 = *crp & (RS_fgMask | RS_bgMask); |
1988 | cc1 = *crp & (RS_fgMask | RS_bgMask); |
1982 | if (ISSET_PIXCOLOR (Color_cursor)) |
1989 | if (ISSET_PIXCOLOR (Color_cursor)) |
1983 | ccol1 = Color_cursor; |
1990 | ccol1 = Color_cursor; |
1984 | else |
1991 | else |
1985 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
1992 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
1986 | ccol1 = GET_FGCOLOR (rstyle); |
1993 | ccol1 = fgcolor_of (rstyle); |
1987 | #else |
1994 | #else |
1988 | ccol1 = Color_fg; |
1995 | ccol1 = Color_fg; |
1989 | #endif |
1996 | #endif |
1990 | if (ISSET_PIXCOLOR (Color_cursor2)) |
1997 | if (ISSET_PIXCOLOR (Color_cursor2)) |
1991 | ccol2 = Color_cursor2; |
1998 | ccol2 = Color_cursor2; |
1992 | else |
1999 | else |
1993 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
2000 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
1994 | ccol2 = GET_BGCOLOR (rstyle); |
2001 | ccol2 = bgcolor_of (rstyle); |
1995 | #else |
2002 | #else |
1996 | ccol2 = Color_bg; |
2003 | ccol2 = Color_bg; |
1997 | #endif |
2004 | #endif |
1998 | *crp = SET_FGCOLOR (*crp, ccol1); |
2005 | *crp = SET_FGCOLOR (*crp, ccol1); |
1999 | *crp = SET_BGCOLOR (*crp, ccol2); |
2006 | *crp = SET_BGCOLOR (*crp, ccol2); |
… | |
… | |
2180 | count++, i--; |
2187 | count++, i--; |
2181 | |
2188 | |
2182 | /* |
2189 | /* |
2183 | * Determine the attributes for the string |
2190 | * Determine the attributes for the string |
2184 | */ |
2191 | */ |
2185 | int fore = GET_FGCOLOR (rend); // desired foreground |
2192 | int fore = fgcolor_of (rend); // desired foreground |
2186 | int back = GET_BGCOLOR (rend); // desired background |
2193 | int back = bgcolor_of (rend); // desired background |
2187 | |
2194 | |
2188 | // only do special processing if any attributes are set, which is rare |
2195 | // only do special processing if any attributes are set, which is unlikely |
2189 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2196 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2190 | { |
2197 | { |
2191 | #if ENABLE_STYLES |
2198 | #if ENABLE_STYLES |
2192 | // force redraw after "careful" characters to avoid pixel droppings |
2199 | // force redraw after "careful" characters to avoid pixel droppings |
2193 | if (srp[col] & RS_Careful && col < ncol - 1 && 0) |
2200 | if (srp[col] & RS_Careful && col < ncol - 1 && 0) |
… | |
… | |
2312 | */ |
2319 | */ |
2313 | if (showcursor) |
2320 | if (showcursor) |
2314 | { |
2321 | { |
2315 | if (focus) |
2322 | if (focus) |
2316 | { |
2323 | { |
2317 | if (options & Opt_cursorUnderline) |
2324 | if (OPTION (Opt_cursorUnderline)) |
2318 | *crp ^= RS_Uline; |
2325 | *crp ^= RS_Uline; |
2319 | else |
2326 | else |
2320 | { |
2327 | { |
2321 | *crp ^= RS_RVid; |
2328 | *crp ^= RS_RVid; |
2322 | #ifndef NO_CURSORCOLOR |
2329 | #ifndef NO_CURSORCOLOR |
… | |
… | |
2441 | |
2448 | |
2442 | #if ENABLE_FRILLS |
2449 | #if ENABLE_FRILLS |
2443 | if (selection.rect) |
2450 | if (selection.rect) |
2444 | { |
2451 | { |
2445 | for (row = max (selection.beg.row, -view_start); row <= min (selection.end.row, view_end); row++) |
2452 | for (row = max (selection.beg.row, -view_start); row <= min (selection.end.row, view_end); row++) |
|
|
2453 | { |
|
|
2454 | text_t *stp = ROW(row).t; |
|
|
2455 | rend_t *srp = ROW(row).r; |
|
|
2456 | |
2446 | for (rend_t *srp = ROW(row).r, col = selection.beg.col; col < selection.end.col; col++) |
2457 | for (col = selection.beg.col; col < selection.end.col; col++) |
2447 | srp[col] ^= RS_RVid; |
2458 | srp[col] ^= RS_RVid; |
|
|
2459 | |
|
|
2460 | while (col-- > selection.beg.col && (stp[col] == NOCHAR || unicode::is_space (stp[col]))) |
|
|
2461 | srp[col] ^= RS_RVid | RS_Uline; |
|
|
2462 | } |
2448 | } |
2463 | } |
2449 | else |
2464 | else |
2450 | #endif |
2465 | #endif |
2451 | { |
2466 | { |
2452 | if (selection.beg.row >= -view_start) |
2467 | if (selection.beg.row >= -view_start) |
… | |
… | |
2455 | row = selection.beg.row; |
2470 | row = selection.beg.row; |
2456 | } |
2471 | } |
2457 | else |
2472 | else |
2458 | { |
2473 | { |
2459 | col = 0; |
2474 | col = 0; |
2460 | row = view_start; |
2475 | row = -view_start; |
2461 | } |
2476 | } |
2462 | |
2477 | |
2463 | for (; row < min (selection.end.row, view_end); row++, col = 0) |
2478 | for (; row < min (selection.end.row, view_end); row++, col = 0) |
2464 | for (rend_t *srp = ROW(row).r; col < ncol; col++) |
2479 | for (rend_t *srp = ROW(row).r; col < ncol; col++) |
2465 | srp[col] ^= RS_RVid; |
2480 | srp[col] ^= RS_RVid; |
… | |
… | |
2879 | #endif |
2894 | #endif |
2880 | end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN |
2895 | end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN |
2881 | |
2896 | |
2882 | col = max (col, 0); |
2897 | col = max (col, 0); |
2883 | |
2898 | |
2884 | if (row == selection.end.row || selection.rect) |
2899 | if (row == selection.end.row |
|
|
2900 | #if ENABLE_FRILLS |
|
|
2901 | || selection.rect |
|
|
2902 | #endif |
|
|
2903 | ) |
2885 | end_col = min (end_col, selection.end.col); |
2904 | min_it (end_col, selection.end.col); |
2886 | |
2905 | |
2887 | t = ROW(row).t + col; |
2906 | t = ROW(row).t + col; |
2888 | for (; col < end_col; col++) |
2907 | for (; col < end_col; col++) |
2889 | { |
2908 | { |
2890 | if (*t == NOCHAR) |
2909 | if (*t == NOCHAR) |
… | |
… | |
2908 | #endif |
2927 | #endif |
2909 | else |
2928 | else |
2910 | new_selection_text[ofs++] = *t++; |
2929 | new_selection_text[ofs++] = *t++; |
2911 | } |
2930 | } |
2912 | |
2931 | |
|
|
2932 | #if ENABLE_FRILLS |
|
|
2933 | if (selection.rect) |
|
|
2934 | { |
|
|
2935 | while (ofs |
|
|
2936 | && new_selection_text[ofs - 1] != C0_LF |
|
|
2937 | && unicode::is_space (new_selection_text[ofs - 1])) |
|
|
2938 | --ofs; |
|
|
2939 | |
|
|
2940 | new_selection_text[ofs++] = C0_LF; |
|
|
2941 | } |
|
|
2942 | else |
|
|
2943 | #endif |
2913 | if (!ROW(row).is_longer () && row != selection.end.row) |
2944 | if (!ROW(row).is_longer () && row != selection.end.row) |
2914 | new_selection_text[ofs++] = C0_LF; |
2945 | new_selection_text[ofs++] = C0_LF; |
2915 | } |
2946 | } |
2916 | |
2947 | |
2917 | if (end_col != selection.end.col) |
2948 | if (end_col != selection.end.col) |
2918 | new_selection_text[ofs++] = C0_LF; |
2949 | new_selection_text[ofs++] = C0_LF; |
2919 | |
2950 | |
… | |
… | |
3270 | selection_delimit_word (DN, &selection.end, &selection.end); |
3301 | selection_delimit_word (DN, &selection.end, &selection.end); |
3271 | } |
3302 | } |
3272 | else if (selection.clicks == 3) |
3303 | else if (selection.clicks == 3) |
3273 | { |
3304 | { |
3274 | #if ENABLE_FRILLS |
3305 | #if ENABLE_FRILLS |
3275 | if (options & Opt_tripleclickwords) |
3306 | if (OPTION (Opt_tripleclickwords)) |
3276 | { |
3307 | { |
3277 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3308 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3278 | |
3309 | |
3279 | for (int end_row = selection.mark.row; end_row < nrow; end_row++) |
3310 | for (int end_row = selection.mark.row; end_row < nrow; end_row++) |
3280 | { |
3311 | { |
… | |
… | |
3341 | { |
3372 | { |
3342 | stp = ROW(end_row).t; |
3373 | stp = ROW(end_row).t; |
3343 | |
3374 | |
3344 | while (--end_col >= 0) |
3375 | while (--end_col >= 0) |
3345 | { |
3376 | { |
3346 | if (stp[end_col] != ' ' |
3377 | if (stp[end_col] != NOCHAR |
3347 | && stp[end_col] != '\t' |
3378 | && !unicode::is_space (stp[end_col])) |
3348 | && stp[end_col] != NOCHAR) |
|
|
3349 | break; |
3379 | break; |
3350 | } |
3380 | } |
3351 | |
3381 | |
3352 | if (end_col >= 0 |
3382 | if (end_col >= 0 |
3353 | || !ROW(end_row - 1).is_longer ()) |
3383 | || !ROW(end_row - 1).is_longer ()) |
… | |
… | |
3669 | for (int y = ov_h; y--; ) |
3699 | for (int y = ov_h; y--; ) |
3670 | { |
3700 | { |
3671 | text_t *t1 = ov_text[y]; |
3701 | text_t *t1 = ov_text[y]; |
3672 | rend_t *r1 = ov_rend[y]; |
3702 | rend_t *r1 = ov_rend[y]; |
3673 | |
3703 | |
3674 | text_t *t2 = ROW(y - view_start).t + ov_x; |
3704 | text_t *t2 = ROW(y + ov_y - view_start).t + ov_x; |
3675 | rend_t *r2 = ROW(y - view_start).r + ov_x; |
3705 | rend_t *r2 = ROW(y + ov_y - view_start).r + ov_x; |
3676 | |
3706 | |
3677 | for (int x = ov_w; x--; ) |
3707 | for (int x = ov_w; x--; ) |
3678 | { |
3708 | { |
3679 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3709 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3680 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |
3710 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |