… | |
… | |
30 | |
30 | |
31 | #include <inttypes.h> |
31 | #include <inttypes.h> |
32 | |
32 | |
33 | #include "salloc.C" // HACK, should be a seperate compile! |
33 | #include "salloc.C" // HACK, should be a seperate compile! |
34 | |
34 | |
|
|
35 | static inline void |
35 | static inline void fill_text (text_t *start, text_t value, int len) |
36 | fill_text (text_t *start, text_t value, int len) |
36 | { |
37 | { |
37 | while (len--) |
38 | while (len--) |
38 | *start++ = value; |
39 | *start++ = value; |
39 | } |
40 | } |
40 | |
41 | |
… | |
… | |
1338 | min_it (num, nrow - row); |
1339 | min_it (num, nrow - row); |
1339 | |
1340 | |
1340 | // TODO: the code below does not work when view_start != 0 |
1341 | // TODO: the code below does not work when view_start != 0 |
1341 | // the workaround is to disable the clear and use a normal refresh |
1342 | // the workaround is to disable the clear and use a normal refresh |
1342 | // when view_start != 0. mysterious. |
1343 | // when view_start != 0. mysterious. |
1343 | if (rstyle & (RS_RVid | RS_Uline)) |
1344 | if (rstyle & (RS_Blink | RS_RVid | RS_Uline)) |
1344 | ren = (rend_t) ~RS_None; |
1345 | ren = (rend_t) ~RS_None; |
1345 | else if (GET_BASEBG (rstyle) == Color_bg) |
1346 | else if (GET_BASEBG (rstyle) == Color_bg) |
1346 | { |
1347 | { |
1347 | ren = DEFAULT_RSTYLE; |
1348 | ren = DEFAULT_RSTYLE; |
1348 | |
1349 | |
… | |
… | |
2085 | ccol2 = bgcolor_of (rstyle); |
2086 | ccol2 = bgcolor_of (rstyle); |
2086 | #else |
2087 | #else |
2087 | ccol2 = Color_bg; |
2088 | ccol2 = Color_bg; |
2088 | #endif |
2089 | #endif |
2089 | |
2090 | |
2090 | if (showcursor && focus) |
2091 | if (focus) |
2091 | { |
2092 | { |
2092 | if (option (Opt_cursorUnderline)) |
2093 | if (option (Opt_cursorUnderline)) |
2093 | *crp ^= RS_Uline; |
2094 | *crp ^= RS_Uline; |
2094 | else |
2095 | else |
2095 | { |
2096 | { |
… | |
… | |
2231 | |
2232 | |
2232 | // seek to the beginning of wide characters |
2233 | // seek to the beginning of wide characters |
2233 | while (expect_false (stp[col] == NOCHAR && col > 0)) |
2234 | while (expect_false (stp[col] == NOCHAR && col > 0)) |
2234 | --col; |
2235 | --col; |
2235 | |
2236 | |
2236 | rend_t rend = srp[col]; /* screen rendition (target rendtion) */ |
2237 | rend_t rend = srp[col]; /* screen rendition (target rendition) */ |
2237 | text_t *text = stp + col; |
2238 | text_t *text = stp + col; |
2238 | int count = 1; |
2239 | int count = 1; |
2239 | |
2240 | |
2240 | dtp[col] = stp[col]; |
2241 | dtp[col] = stp[col]; |
2241 | drp[col] = rend; |
2242 | drp[col] = rend; |
… | |
… | |
2286 | */ |
2287 | */ |
2287 | int fore = fgcolor_of (rend); // desired foreground |
2288 | int fore = fgcolor_of (rend); // desired foreground |
2288 | int back = bgcolor_of (rend); // desired background |
2289 | int back = bgcolor_of (rend); // desired background |
2289 | |
2290 | |
2290 | // only do special processing if any attributes are set, which is unlikely |
2291 | // only do special processing if any attributes are set, which is unlikely |
2291 | if (expect_false (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful))) |
2292 | if (expect_false (rend & (RS_baseattrMask | RS_Careful | RS_Sel))) |
2292 | { |
2293 | { |
2293 | bool invert = rend & RS_RVid; |
2294 | bool invert = rend & RS_RVid; |
2294 | |
2295 | |
2295 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2296 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2296 | if (rend & RS_Bold && fore == Color_fg) |
2297 | if (rend & RS_Bold && fore == Color_fg) |
… | |
… | |
2315 | |
2316 | |
2316 | if (rend & RS_Uline && fore == Color_fg && ISSET_PIXCOLOR (Color_UL)) |
2317 | if (rend & RS_Uline && fore == Color_fg && ISSET_PIXCOLOR (Color_UL)) |
2317 | fore = Color_UL; |
2318 | fore = Color_UL; |
2318 | #endif |
2319 | #endif |
2319 | |
2320 | |
|
|
2321 | #ifdef OPTION_HC |
|
|
2322 | if (rend & RS_Sel) |
|
|
2323 | { |
|
|
2324 | /* invert the column if no highlightColor is set or it is the |
|
|
2325 | * current cursor column */ |
|
|
2326 | if (!(showcursor && row == screen.cur.row && text - stp == screen.cur.col) |
|
|
2327 | && ISSET_PIXCOLOR (Color_HC)) |
|
|
2328 | { |
|
|
2329 | if (ISSET_PIXCOLOR (Color_HTC)) |
|
|
2330 | fore = Color_HTC; |
|
|
2331 | // if invert is 0 reverse video is set so we use bg color as fg color |
|
|
2332 | else if (!invert) |
|
|
2333 | fore = back; |
|
|
2334 | |
|
|
2335 | back = Color_HC; |
|
|
2336 | invert = 0; |
|
|
2337 | } |
|
|
2338 | } |
|
|
2339 | #endif |
|
|
2340 | |
2320 | if (invert) |
2341 | if (invert) |
2321 | { |
2342 | { |
2322 | #ifdef OPTION_HC |
|
|
2323 | if ((showcursor && row == screen.cur.row && text - stp == screen.cur.col) |
|
|
2324 | || !ISSET_PIXCOLOR (Color_HC)) |
|
|
2325 | #endif |
|
|
2326 | /* invert the column if no highlightColor is set or it is the |
|
|
2327 | * current cursor column */ |
|
|
2328 | ::swap (fore, back); |
2343 | ::swap (fore, back); |
2329 | #ifdef OPTION_HC |
|
|
2330 | else if (ISSET_PIXCOLOR (Color_HC)) |
|
|
2331 | back = Color_HC; |
|
|
2332 | #endif |
|
|
2333 | |
2344 | |
2334 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2345 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2335 | # ifndef OPTION_HC |
|
|
2336 | if (ISSET_PIXCOLOR (Color_RV)) |
|
|
2337 | back = Color_RV; |
|
|
2338 | # endif |
|
|
2339 | if (fore == back) |
2346 | if (fore == back) |
2340 | { |
2347 | { |
2341 | fore = Color_bg; |
2348 | fore = Color_bg; |
2342 | back = Color_fg; |
2349 | back = Color_fg; |
2343 | } |
2350 | } |
… | |
… | |
2377 | } |
2384 | } |
2378 | |
2385 | |
2379 | /* |
2386 | /* |
2380 | * Actually do the drawing of the string here |
2387 | * Actually do the drawing of the string here |
2381 | */ |
2388 | */ |
2382 | rxvt_font *font = fontset [GET_STYLE (rend)]->get (*text, GET_FONT (rend)); |
2389 | rxvt_font *font = (*fontset[GET_STYLE (rend)])[GET_FONT (rend)]; |
2383 | |
2390 | |
2384 | if (expect_true (have_bg && back == Color_bg)) |
2391 | if (expect_true (have_bg && back == Color_bg)) |
2385 | { |
2392 | { |
2386 | // this is very ugly, maybe push it into ->draw? |
2393 | // this is very ugly, maybe push it into ->draw? |
2387 | |
2394 | |
… | |
… | |
2596 | { |
2603 | { |
2597 | #if !ENABLE_MINIMAL |
2604 | #if !ENABLE_MINIMAL |
2598 | if (selection.rect) |
2605 | if (selection.rect) |
2599 | scr_xor_rect (selection.beg.row, selection.beg.col, |
2606 | scr_xor_rect (selection.beg.row, selection.beg.col, |
2600 | selection.end.row, selection.end.col, |
2607 | selection.end.row, selection.end.col, |
2601 | RS_RVid, RS_RVid | RS_Uline); |
2608 | RS_Sel | RS_RVid, RS_Sel | RS_RVid | RS_Uline); |
2602 | else |
2609 | else |
2603 | #endif |
2610 | #endif |
2604 | scr_xor_span (selection.beg.row, selection.beg.col, |
2611 | scr_xor_span (selection.beg.row, selection.beg.col, |
2605 | selection.end.row, selection.end.col, |
2612 | selection.end.row, selection.end.col, |
2606 | RS_RVid); |
2613 | RS_Sel | RS_RVid); |
2607 | } |
2614 | } |
2608 | } |
2615 | } |
2609 | |
2616 | |
2610 | /* ------------------------------------------------------------------------- */ |
2617 | /* ------------------------------------------------------------------------- */ |
2611 | /* |
2618 | /* |
… | |
… | |
2904 | selection_wait = Sel_normal; |
2911 | selection_wait = Sel_normal; |
2905 | |
2912 | |
2906 | #if X_HAVE_UTF8_STRING |
2913 | #if X_HAVE_UTF8_STRING |
2907 | selection_type = Sel_UTF8String; |
2914 | selection_type = Sel_UTF8String; |
2908 | if (selection_request_other (xa[XA_UTF8_STRING], selnum)) |
2915 | if (selection_request_other (xa[XA_UTF8_STRING], selnum)) |
2909 | return; |
2916 | return; |
2910 | #else |
2917 | #else |
2911 | selection_type = Sel_CompoundText; |
2918 | selection_type = Sel_CompoundText; |
2912 | if (selection_request_other (xa[XA_COMPOUND_TEXT], selnum)) |
2919 | if (selection_request_other (xa[XA_COMPOUND_TEXT], selnum)) |
2913 | return; |
2920 | return; |
2914 | #endif |
2921 | #endif |
2915 | } |
2922 | } |
2916 | |
2923 | |
2917 | selection_wait = Sel_none; /* don't loop in selection_paste () */ |
2924 | selection_wait = Sel_none; /* don't loop in selection_paste () */ |
2918 | selection_paste (display->root, XA_CUT_BUFFER0, false); |
2925 | selection_paste (display->root, XA_CUT_BUFFER0, false); |
… | |
… | |
2967 | selection.clip_text = NULL; |
2974 | selection.clip_text = NULL; |
2968 | selection.clip_len = 0; |
2975 | selection.clip_len = 0; |
2969 | |
2976 | |
2970 | if (display->clipboard_owner == this) |
2977 | if (display->clipboard_owner == this) |
2971 | display->clipboard_owner = 0; |
2978 | display->clipboard_owner = 0; |
2972 | } |
|
|
2973 | } |
|
|
2974 | |
|
|
2975 | void |
|
|
2976 | rxvt_term::clipboard_copy (Time tm) |
|
|
2977 | { |
|
|
2978 | if (selection.len > 0) |
|
|
2979 | { |
|
|
2980 | free (selection.clip_text); |
|
|
2981 | selection.clip_len = selection.len; |
|
|
2982 | selection.clip_text = (wchar_t *) malloc (sizeof (wchar_t) * selection.clip_len); |
|
|
2983 | memcpy (selection.clip_text, selection.text, |
|
|
2984 | sizeof (wchar_t) * selection.clip_len); |
|
|
2985 | selection_grab (tm, true); |
|
|
2986 | } |
2979 | } |
2987 | } |
2980 | } |
2988 | |
2981 | |
2989 | /* ------------------------------------------------------------------------- */ |
2982 | /* ------------------------------------------------------------------------- */ |
2990 | /* |
2983 | /* |