… | |
… | |
28 | #include "rxvt.h" /* NECESSARY */ |
28 | #include "rxvt.h" /* NECESSARY */ |
29 | #include "rxvtperl.h" /* NECESSARY */ |
29 | #include "rxvtperl.h" /* NECESSARY */ |
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 separate 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 | |
… | |
… | |
1335 | if (row >= nrow) /* Out Of Bounds */ |
1336 | if (row >= nrow) /* Out Of Bounds */ |
1336 | return; |
1337 | return; |
1337 | |
1338 | |
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 | // the workaround is to disable the clear and use a normal refresh |
|
|
1342 | // when view_start != 0. mysterious. |
|
|
1343 | if (rstyle & (RS_RVid | RS_Uline)) |
1341 | if (rstyle & (RS_Blink | RS_RVid | RS_Uline)) |
1344 | ren = (rend_t) ~RS_None; |
1342 | ren = (rend_t) ~RS_None; |
1345 | else if (GET_BASEBG (rstyle) == Color_bg) |
1343 | else if (GET_BASEBG (rstyle) == Color_bg) |
1346 | { |
1344 | { |
1347 | ren = DEFAULT_RSTYLE; |
1345 | ren = DEFAULT_RSTYLE; |
1348 | |
1346 | |
1349 | if (mapped && !view_start) |
1347 | if (mapped) |
1350 | XClearArea (dpy, vt, 0, |
1348 | XClearArea (dpy, vt, 0, |
1351 | Row2Pixel (row - view_start), (unsigned int)width, |
1349 | Row2Pixel (row - view_start), (unsigned int)width, |
1352 | (unsigned int)Height2Pixel (num), False); |
1350 | (unsigned int)Height2Pixel (num), False); |
1353 | } |
1351 | } |
1354 | else |
1352 | else |
1355 | { |
1353 | { |
1356 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1354 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1357 | |
1355 | |
1358 | if (mapped && !view_start) |
1356 | if (mapped) |
1359 | { |
1357 | { |
1360 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1358 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1361 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1359 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1362 | XFillRectangle (dpy, vt, gc, |
1360 | XFillRectangle (dpy, vt, gc, |
1363 | 0, Row2Pixel (row - view_start), |
1361 | 0, Row2Pixel (row - view_start), |
… | |
… | |
1370 | |
1368 | |
1371 | for (; num--; row++) |
1369 | for (; num--; row++) |
1372 | { |
1370 | { |
1373 | scr_blank_screen_mem (ROW(row), rstyle); |
1371 | scr_blank_screen_mem (ROW(row), rstyle); |
1374 | |
1372 | |
1375 | if (!view_start) |
1373 | if (row - view_start < nrow) |
1376 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1374 | scr_blank_line (drawn_buf [row - view_start], 0, ncol, ren); |
1377 | } |
1375 | } |
1378 | } |
1376 | } |
1379 | |
1377 | |
1380 | #if !ENABLE_MINIMAL |
1378 | #if !ENABLE_MINIMAL |
1381 | void |
1379 | void |
… | |
… | |
2328 | if (ISSET_PIXCOLOR (Color_HTC)) |
2326 | if (ISSET_PIXCOLOR (Color_HTC)) |
2329 | fore = Color_HTC; |
2327 | fore = Color_HTC; |
2330 | // if invert is 0 reverse video is set so we use bg color as fg color |
2328 | // if invert is 0 reverse video is set so we use bg color as fg color |
2331 | else if (!invert) |
2329 | else if (!invert) |
2332 | fore = back; |
2330 | fore = back; |
|
|
2331 | |
2333 | back = Color_HC; |
2332 | back = Color_HC; |
2334 | invert = 0; |
2333 | invert = 0; |
2335 | } |
2334 | } |
2336 | } |
2335 | } |
2337 | #endif |
2336 | #endif |
… | |
… | |
2677 | /* ------------------------------------------------------------------------- */ |
2676 | /* ------------------------------------------------------------------------- */ |
2678 | /* |
2677 | /* |
2679 | * Paste a selection direct to the command fd |
2678 | * Paste a selection direct to the command fd |
2680 | */ |
2679 | */ |
2681 | void |
2680 | void |
2682 | rxvt_term::paste (char *data, unsigned int len) NOTHROW |
2681 | rxvt_term::tt_paste (char *data, unsigned int len) NOTHROW |
2683 | { |
2682 | { |
2684 | /* convert normal newline chars into common keyboard Return key sequence */ |
2683 | /* convert normal newline chars into common keyboard Return key sequence */ |
2685 | for (unsigned int i = 0; i < len; i++) |
2684 | for (unsigned int i = 0; i < len; i++) |
2686 | if (data[i] == C0_LF) |
2685 | if (data[i] == C0_LF) |
2687 | data[i] = C0_CR; |
2686 | data[i] = C0_CR; |
… | |
… | |
2691 | |
2690 | |
2692 | tt_write (data, len); |
2691 | tt_write (data, len); |
2693 | |
2692 | |
2694 | if (priv_modes & PrivMode_BracketPaste) |
2693 | if (priv_modes & PrivMode_BracketPaste) |
2695 | tt_printf ("\e[201~"); |
2694 | tt_printf ("\e[201~"); |
|
|
2695 | } |
|
|
2696 | |
|
|
2697 | void |
|
|
2698 | rxvt_term::paste (char *data, unsigned int len) NOTHROW |
|
|
2699 | { |
|
|
2700 | if (HOOK_INVOKE ((this, HOOK_TT_PASTE, DT_STR_LEN, data, len, DT_END))) |
|
|
2701 | return; |
|
|
2702 | |
|
|
2703 | tt_paste (data, len); |
2696 | } |
2704 | } |
2697 | |
2705 | |
2698 | /* ------------------------------------------------------------------------- */ |
2706 | /* ------------------------------------------------------------------------- */ |
2699 | /* |
2707 | /* |
2700 | * Respond to a notification that a primary selection has been sent |
2708 | * Respond to a notification that a primary selection has been sent |
… | |
… | |
2972 | selection.clip_text = NULL; |
2980 | selection.clip_text = NULL; |
2973 | selection.clip_len = 0; |
2981 | selection.clip_len = 0; |
2974 | |
2982 | |
2975 | if (display->clipboard_owner == this) |
2983 | if (display->clipboard_owner == this) |
2976 | display->clipboard_owner = 0; |
2984 | display->clipboard_owner = 0; |
2977 | } |
|
|
2978 | } |
|
|
2979 | |
|
|
2980 | void |
|
|
2981 | rxvt_term::clipboard_copy (Time tm) |
|
|
2982 | { |
|
|
2983 | if (selection.len > 0) |
|
|
2984 | { |
|
|
2985 | free (selection.clip_text); |
|
|
2986 | selection.clip_len = selection.len; |
|
|
2987 | selection.clip_text = (wchar_t *) malloc (sizeof (wchar_t) * selection.clip_len); |
|
|
2988 | memcpy (selection.clip_text, selection.text, |
|
|
2989 | sizeof (wchar_t) * selection.clip_len); |
|
|
2990 | selection_grab (tm, true); |
|
|
2991 | } |
2985 | } |
2992 | } |
2986 | } |
2993 | |
2987 | |
2994 | /* ------------------------------------------------------------------------- */ |
2988 | /* ------------------------------------------------------------------------- */ |
2995 | /* |
2989 | /* |