… | |
… | |
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() \ |
… | |
… | |
530 | |
530 | |
531 | screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); |
531 | screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); |
532 | screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); |
532 | screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); |
533 | |
533 | |
534 | #if NSCREENS |
534 | #if NSCREENS |
535 | if (options & Opt_secondaryScreen) |
535 | if (OPTION (Opt_secondaryScreen)) |
536 | { |
536 | { |
537 | num_scr = 0; |
537 | num_scr = 0; |
538 | |
538 | |
539 | for (int i = prev_nrow; i--; ) |
539 | for (int i = prev_nrow; i--; ) |
540 | ::swap (ROW(i), swap_buf [i]); |
540 | ::swap (ROW(i), swap_buf [i]); |
… | |
… | |
544 | screen.flags |= Screen_VisibleCursor; |
544 | screen.flags |= Screen_VisibleCursor; |
545 | swap.flags |= Screen_VisibleCursor; |
545 | swap.flags |= Screen_VisibleCursor; |
546 | } |
546 | } |
547 | else |
547 | else |
548 | #endif |
548 | #endif |
549 | if (options & Opt_secondaryScroll) |
549 | if (OPTION (Opt_secondaryScroll)) |
550 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
550 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
551 | |
551 | |
552 | return scrn; |
552 | return scrn; |
553 | } |
553 | } |
554 | |
554 | |
… | |
… | |
616 | num_scr += count; |
616 | num_scr += count; |
617 | |
617 | |
618 | if (count > 0 |
618 | if (count > 0 |
619 | && row1 == 0 |
619 | && row1 == 0 |
620 | && row2 == nrow - 1 |
620 | && row2 == nrow - 1 |
621 | && (current_screen == PRIMARY || options & Opt_secondaryScroll)) |
621 | && (current_screen == PRIMARY || OPTION (Opt_secondaryScroll))) |
622 | { |
622 | { |
623 | nsaved = min (nsaved + count, saveLines); |
623 | nsaved = min (nsaved + count, saveLines); |
624 | term_start = (term_start + count) % total_rows; |
624 | term_start = (term_start + count) % total_rows; |
625 | |
625 | |
626 | if (selection.op && current_screen == selection.screen) |
626 | if (selection.op && current_screen == selection.screen) |
… | |
… | |
642 | { |
642 | { |
643 | ROW(row2 - i).l = 0; |
643 | ROW(row2 - i).l = 0; |
644 | scr_blank_screen_mem (ROW(row2 - i), rstyle); |
644 | scr_blank_screen_mem (ROW(row2 - i), rstyle); |
645 | } |
645 | } |
646 | |
646 | |
647 | if ((options & Opt_scrollWithBuffer) |
647 | if (OPTION (Opt_scrollWithBuffer) |
648 | && view_start != 0 |
648 | && view_start != 0 |
649 | && view_start != saveLines) |
649 | && view_start != saveLines) |
650 | scr_page (UP, count); |
650 | scr_page (UP, count); |
651 | } |
651 | } |
652 | else |
652 | else |
… | |
… | |
1018 | if (count) |
1018 | if (count) |
1019 | x = ncol - 1; |
1019 | x = ncol - 1; |
1020 | |
1020 | |
1021 | // store horizontal tab commands as characters inside the text |
1021 | // store horizontal tab commands as characters inside the text |
1022 | // buffer so they can be selected and pasted. |
1022 | // buffer so they can be selected and pasted. |
1023 | if (ht && options & Opt_pastableTabs) |
1023 | if (ht && OPTION (Opt_pastableTabs)) |
1024 | { |
1024 | { |
1025 | base_rend = SET_FONT (base_rend, 0); |
1025 | base_rend = SET_FONT (base_rend, 0); |
1026 | |
1026 | |
1027 | if (!l.is_longer ()) /* XXX: think about this */ |
1027 | if (!l.is_longer ()) /* XXX: think about this */ |
1028 | max_it (l.l, x); |
1028 | max_it (l.l, x); |
… | |
… | |
1284 | CLEAR_ROWS (row, num); |
1284 | CLEAR_ROWS (row, num); |
1285 | } |
1285 | } |
1286 | else |
1286 | else |
1287 | { |
1287 | { |
1288 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1288 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1289 | gcvalue.foreground = pix_colors[GET_BGCOLOR (rstyle)]; |
1289 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1290 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1290 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1291 | ERASE_ROWS (row, num); |
1291 | ERASE_ROWS (row, num); |
1292 | gcvalue.foreground = pix_colors[Color_fg]; |
1292 | gcvalue.foreground = pix_colors[Color_fg]; |
1293 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1293 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1294 | } |
1294 | } |
… | |
… | |
1593 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1593 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1594 | #if XPM_BACKGROUND |
1594 | #if XPM_BACKGROUND |
1595 | if (bgPixmap.pixmap == None) |
1595 | if (bgPixmap.pixmap == None) |
1596 | #endif |
1596 | #endif |
1597 | #if TRANSPARENT |
1597 | #if TRANSPARENT |
1598 | if (! (options & Opt_transparent) || am_transparent == 0) |
1598 | if (! OPTION (Opt_transparent) || am_transparent == 0) |
1599 | #endif |
1599 | #endif |
1600 | XSetWindowBackground (display->display, vt, |
1600 | XSetWindowBackground (display->display, vt, |
1601 | pix_colors[Color_bg]); |
1601 | pix_colors[Color_bg]); |
1602 | |
1602 | |
1603 | gcvalue.foreground = pix_colors[Color_fg]; |
1603 | gcvalue.foreground = pix_colors[Color_fg]; |
… | |
… | |
1836 | { |
1836 | { |
1837 | #ifndef NO_BELL |
1837 | #ifndef NO_BELL |
1838 | |
1838 | |
1839 | # ifndef NO_MAPALERT |
1839 | # ifndef NO_MAPALERT |
1840 | # ifdef MAPALERT_OPTION |
1840 | # ifdef MAPALERT_OPTION |
1841 | if (options & Opt_mapAlert) |
1841 | if (OPTION (Opt_mapAlert)) |
1842 | # endif |
1842 | # endif |
1843 | XMapWindow (display->display, parent[0]); |
1843 | XMapWindow (display->display, parent[0]); |
1844 | # endif |
1844 | # endif |
1845 | |
1845 | |
1846 | if (options & Opt_visualBell) |
1846 | if (OPTION (Opt_visualBell)) |
1847 | { |
1847 | { |
1848 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1848 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1849 | rxvt_usleep (VISUAL_BELL_DURATION); |
1849 | rxvt_usleep (VISUAL_BELL_DURATION); |
1850 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1850 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1851 | } |
1851 | } |
… | |
… | |
1942 | |
1942 | |
1943 | #if XPM_BACKGROUND |
1943 | #if XPM_BACKGROUND |
1944 | must_clear |= bgPixmap.pixmap != None; |
1944 | must_clear |= bgPixmap.pixmap != None; |
1945 | #endif |
1945 | #endif |
1946 | #if TRANSPARENT |
1946 | #if TRANSPARENT |
1947 | must_clear |= (options & Opt_transparent) && am_transparent; |
1947 | must_clear |= OPTION (Opt_transparent) && am_transparent; |
1948 | #endif |
1948 | #endif |
1949 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
1949 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
1950 | |
1950 | |
1951 | /* |
1951 | /* |
1952 | * B: reverse any characters which are selected |
1952 | * B: reverse any characters which are selected |
… | |
… | |
1976 | |
1976 | |
1977 | crp = &ROW(screen.cur.row).r[col]; |
1977 | crp = &ROW(screen.cur.row).r[col]; |
1978 | |
1978 | |
1979 | if (showcursor && focus) |
1979 | if (showcursor && focus) |
1980 | { |
1980 | { |
1981 | if (options & Opt_cursorUnderline) |
1981 | if (OPTION (Opt_cursorUnderline)) |
1982 | *crp ^= RS_Uline; |
1982 | *crp ^= RS_Uline; |
1983 | else |
1983 | else |
1984 | { |
1984 | { |
1985 | *crp ^= RS_RVid; |
1985 | *crp ^= RS_RVid; |
1986 | |
1986 | |
… | |
… | |
1988 | cc1 = *crp & (RS_fgMask | RS_bgMask); |
1988 | cc1 = *crp & (RS_fgMask | RS_bgMask); |
1989 | if (ISSET_PIXCOLOR (Color_cursor)) |
1989 | if (ISSET_PIXCOLOR (Color_cursor)) |
1990 | ccol1 = Color_cursor; |
1990 | ccol1 = Color_cursor; |
1991 | else |
1991 | else |
1992 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
1992 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
1993 | ccol1 = GET_FGCOLOR (rstyle); |
1993 | ccol1 = fgcolor_of (rstyle); |
1994 | #else |
1994 | #else |
1995 | ccol1 = Color_fg; |
1995 | ccol1 = Color_fg; |
1996 | #endif |
1996 | #endif |
1997 | if (ISSET_PIXCOLOR (Color_cursor2)) |
1997 | if (ISSET_PIXCOLOR (Color_cursor2)) |
1998 | ccol2 = Color_cursor2; |
1998 | ccol2 = Color_cursor2; |
1999 | else |
1999 | else |
2000 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
2000 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
2001 | ccol2 = GET_BGCOLOR (rstyle); |
2001 | ccol2 = bgcolor_of (rstyle); |
2002 | #else |
2002 | #else |
2003 | ccol2 = Color_bg; |
2003 | ccol2 = Color_bg; |
2004 | #endif |
2004 | #endif |
2005 | *crp = SET_FGCOLOR (*crp, ccol1); |
2005 | *crp = SET_FGCOLOR (*crp, ccol1); |
2006 | *crp = SET_BGCOLOR (*crp, ccol2); |
2006 | *crp = SET_BGCOLOR (*crp, ccol2); |
… | |
… | |
2187 | count++, i--; |
2187 | count++, i--; |
2188 | |
2188 | |
2189 | /* |
2189 | /* |
2190 | * Determine the attributes for the string |
2190 | * Determine the attributes for the string |
2191 | */ |
2191 | */ |
2192 | int fore = GET_FGCOLOR (rend); // desired foreground |
2192 | int fore = fgcolor_of (rend); // desired foreground |
2193 | int back = GET_BGCOLOR (rend); // desired background |
2193 | int back = bgcolor_of (rend); // desired background |
2194 | |
2194 | |
2195 | // only do special processing if any attributes are set, which is unlikely |
2195 | // only do special processing if any attributes are set, which is unlikely |
2196 | 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)) |
2197 | { |
2197 | { |
2198 | #if ENABLE_STYLES |
2198 | #if ENABLE_STYLES |
… | |
… | |
2319 | */ |
2319 | */ |
2320 | if (showcursor) |
2320 | if (showcursor) |
2321 | { |
2321 | { |
2322 | if (focus) |
2322 | if (focus) |
2323 | { |
2323 | { |
2324 | if (options & Opt_cursorUnderline) |
2324 | if (OPTION (Opt_cursorUnderline)) |
2325 | *crp ^= RS_Uline; |
2325 | *crp ^= RS_Uline; |
2326 | else |
2326 | else |
2327 | { |
2327 | { |
2328 | *crp ^= RS_RVid; |
2328 | *crp ^= RS_RVid; |
2329 | #ifndef NO_CURSORCOLOR |
2329 | #ifndef NO_CURSORCOLOR |
… | |
… | |
2448 | |
2448 | |
2449 | #if ENABLE_FRILLS |
2449 | #if ENABLE_FRILLS |
2450 | if (selection.rect) |
2450 | if (selection.rect) |
2451 | { |
2451 | { |
2452 | 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 | |
2453 | 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++) |
2454 | 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 | |
|
|
2463 | if (++col < selection.end.col) |
|
|
2464 | srp[col] ^= RS_RVid | RS_Uline; |
|
|
2465 | } |
2455 | } |
2466 | } |
2456 | else |
2467 | else |
2457 | #endif |
2468 | #endif |
2458 | { |
2469 | { |
2459 | if (selection.beg.row >= -view_start) |
2470 | if (selection.beg.row >= -view_start) |
… | |
… | |
2886 | #endif |
2897 | #endif |
2887 | end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN |
2898 | end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN |
2888 | |
2899 | |
2889 | col = max (col, 0); |
2900 | col = max (col, 0); |
2890 | |
2901 | |
2891 | if (row == selection.end.row || selection.rect) |
2902 | if (row == selection.end.row |
|
|
2903 | #if ENABLE_FRILLS |
|
|
2904 | || selection.rect |
|
|
2905 | #endif |
|
|
2906 | ) |
2892 | end_col = min (end_col, selection.end.col); |
2907 | min_it (end_col, selection.end.col); |
2893 | |
2908 | |
2894 | t = ROW(row).t + col; |
2909 | t = ROW(row).t + col; |
2895 | for (; col < end_col; col++) |
2910 | for (; col < end_col; col++) |
2896 | { |
2911 | { |
2897 | if (*t == NOCHAR) |
2912 | if (*t == NOCHAR) |
… | |
… | |
2915 | #endif |
2930 | #endif |
2916 | else |
2931 | else |
2917 | new_selection_text[ofs++] = *t++; |
2932 | new_selection_text[ofs++] = *t++; |
2918 | } |
2933 | } |
2919 | |
2934 | |
|
|
2935 | #if ENABLE_FRILLS |
|
|
2936 | if (selection.rect) |
|
|
2937 | { |
|
|
2938 | while (ofs |
|
|
2939 | && new_selection_text[ofs - 1] != C0_LF |
|
|
2940 | && unicode::is_space (new_selection_text[ofs - 1])) |
|
|
2941 | --ofs; |
|
|
2942 | |
|
|
2943 | new_selection_text[ofs++] = C0_LF; |
|
|
2944 | } |
|
|
2945 | else |
|
|
2946 | #endif |
2920 | if (!ROW(row).is_longer () && row != selection.end.row) |
2947 | if (!ROW(row).is_longer () && row != selection.end.row) |
2921 | new_selection_text[ofs++] = C0_LF; |
2948 | new_selection_text[ofs++] = C0_LF; |
2922 | } |
2949 | } |
2923 | |
2950 | |
2924 | if (end_col != selection.end.col) |
2951 | if (end_col != selection.end.col) |
2925 | new_selection_text[ofs++] = C0_LF; |
2952 | new_selection_text[ofs++] = C0_LF; |
2926 | |
2953 | |
… | |
… | |
3277 | selection_delimit_word (DN, &selection.end, &selection.end); |
3304 | selection_delimit_word (DN, &selection.end, &selection.end); |
3278 | } |
3305 | } |
3279 | else if (selection.clicks == 3) |
3306 | else if (selection.clicks == 3) |
3280 | { |
3307 | { |
3281 | #if ENABLE_FRILLS |
3308 | #if ENABLE_FRILLS |
3282 | if (options & Opt_tripleclickwords) |
3309 | if (OPTION (Opt_tripleclickwords)) |
3283 | { |
3310 | { |
3284 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3311 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3285 | |
3312 | |
3286 | for (int end_row = selection.mark.row; end_row < nrow; end_row++) |
3313 | for (int end_row = selection.mark.row; end_row < nrow; end_row++) |
3287 | { |
3314 | { |
… | |
… | |
3348 | { |
3375 | { |
3349 | stp = ROW(end_row).t; |
3376 | stp = ROW(end_row).t; |
3350 | |
3377 | |
3351 | while (--end_col >= 0) |
3378 | while (--end_col >= 0) |
3352 | { |
3379 | { |
3353 | if (stp[end_col] != ' ' |
3380 | if (stp[end_col] != NOCHAR |
3354 | && stp[end_col] != '\t' |
3381 | && !unicode::is_space (stp[end_col])) |
3355 | && stp[end_col] != NOCHAR) |
|
|
3356 | break; |
3382 | break; |
3357 | } |
3383 | } |
3358 | |
3384 | |
3359 | if (end_col >= 0 |
3385 | if (end_col >= 0 |
3360 | || !ROW(end_row - 1).is_longer ()) |
3386 | || !ROW(end_row - 1).is_longer ()) |