… | |
… | |
842 | |
842 | |
843 | // some utf-8 decoders "decode" surrogate characters: let's fix this. |
843 | // some utf-8 decoders "decode" surrogate characters: let's fix this. |
844 | if (IN_RANGE_INC (c, 0xd800, 0xdfff)) |
844 | if (IN_RANGE_INC (c, 0xd800, 0xdfff)) |
845 | c = 0xfffd; |
845 | c = 0xfffd; |
846 | |
846 | |
847 | // rely on wcwidth to tell us the character width, at least for non-latin1 |
847 | // rely on wcwidth to tell us the character width, do wcwidth before |
848 | // do wcwidth before further replacements, as wcwidth might return -1 |
848 | // further replacements, as wcwidth might return -1 for the line |
849 | // for the line drawing characters below as they might be invalid in the current |
849 | // drawing characters below as they might be invalid in the current |
850 | // locale. |
850 | // locale. |
851 | int width = c < 0x100 ? 1 : wcwidth (c); |
851 | int width = WCWIDTH (c); |
852 | |
852 | |
853 | if (charsets [screen.charset] == '0') // DEC SPECIAL |
853 | if (charsets [screen.charset] == '0') // DEC SPECIAL |
854 | { |
854 | { |
855 | // vt100 special graphics and line drawing |
855 | // vt100 special graphics and line drawing |
856 | // 5f-7e standard vt100 |
856 | // 5f-7e standard vt100 |
… | |
… | |
2244 | |
2244 | |
2245 | // only do special processing if any attributes are set, which is unlikely |
2245 | // only do special processing if any attributes are set, which is unlikely |
2246 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2246 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2247 | { |
2247 | { |
2248 | #if ENABLE_STYLES |
2248 | #if ENABLE_STYLES |
2249 | // force redraw after "careful" characters to avoid pixel droppings |
2249 | // "careful" (too wide) character handling |
2250 | if (srp[col] & RS_Careful && col < ncol - 1 && 0) |
|
|
2251 | drp[col + 1] = ~srp[col + 1]; |
|
|
2252 | |
2250 | |
2253 | // include previous careful character(s) if possible, looks nicer (best effort...) |
2251 | // include previous careful character(s) if possible, looks nicer (best effort...) |
2254 | while (text > stp |
2252 | while (text > stp |
2255 | && srp[text - stp - 1] & RS_Careful |
2253 | && srp[text - stp - 1] & RS_Careful |
2256 | && RS_SAME (rend, srp[text - stp - 1])) |
2254 | && RS_SAME (rend, srp[text - stp - 1])) |
2257 | text--, count++, xpixel -= fwidth; |
2255 | text--, count++, xpixel -= fwidth; |
|
|
2256 | |
|
|
2257 | // force redraw after "careful" characters to avoid pixel droppings |
|
|
2258 | for (int i = 0; srp[col + i] & RS_Careful && col + i < ncol - 1; i++) |
|
|
2259 | drp[col + i + 1] = ~srp[col + i + 1]; |
|
|
2260 | |
|
|
2261 | // force redraw before "careful" characters to avoid pixel droppings |
|
|
2262 | for (int i = 0; srp[text - stp - i] & RS_Careful && text - i > stp; i++) |
|
|
2263 | drp[text - stp - i - 1] = ~srp[text - stp - i - 1]; |
2258 | #endif |
2264 | #endif |
2259 | |
2265 | |
2260 | bool invert = rend & RS_RVid; |
2266 | bool invert = rend & RS_RVid; |
2261 | |
2267 | |
2262 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2268 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
… | |
… | |
3508 | */ |
3514 | */ |
3509 | void |
3515 | void |
3510 | rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW |
3516 | rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW |
3511 | { |
3517 | { |
3512 | XSelectionEvent ev; |
3518 | XSelectionEvent ev; |
3513 | dDisp; |
|
|
3514 | |
3519 | |
3515 | ev.type = SelectionNotify; |
3520 | ev.type = SelectionNotify; |
3516 | ev.property = None; |
3521 | ev.property = None; |
3517 | ev.display = rq.display; |
3522 | ev.display = rq.display; |
3518 | ev.requestor = rq.requestor; |
3523 | ev.requestor = rq.requestor; |
… | |
… | |
3532 | *target++ = xa[XA_COMPOUND_TEXT]; |
3537 | *target++ = xa[XA_COMPOUND_TEXT]; |
3533 | #if X_HAVE_UTF8_STRING |
3538 | #if X_HAVE_UTF8_STRING |
3534 | *target++ = xa[XA_UTF8_STRING]; |
3539 | *target++ = xa[XA_UTF8_STRING]; |
3535 | #endif |
3540 | #endif |
3536 | |
3541 | |
3537 | XChangeProperty (disp, rq.requestor, rq.property, XA_ATOM, |
3542 | XChangeProperty (xdisp, rq.requestor, rq.property, XA_ATOM, |
3538 | 32, PropModeReplace, |
3543 | 32, PropModeReplace, |
3539 | (unsigned char *)target_list, target - target_list); |
3544 | (unsigned char *)target_list, target - target_list); |
3540 | ev.property = rq.property; |
3545 | ev.property = rq.property; |
3541 | } |
3546 | } |
3542 | #if TODO // TODO |
3547 | #if TODO // TODO |
… | |
… | |
3545 | /* TODO: Handle MULTIPLE */ |
3550 | /* TODO: Handle MULTIPLE */ |
3546 | } |
3551 | } |
3547 | #endif |
3552 | #endif |
3548 | else if (rq.target == xa[XA_TIMESTAMP] && selection.text) |
3553 | else if (rq.target == xa[XA_TIMESTAMP] && selection.text) |
3549 | { |
3554 | { |
3550 | XChangeProperty (disp, rq.requestor, rq.property, rq.target, |
3555 | XChangeProperty (xdisp, rq.requestor, rq.property, rq.target, |
3551 | 32, PropModeReplace, (unsigned char *)&selection_time, 1); |
3556 | 32, PropModeReplace, (unsigned char *)&selection_time, 1); |
3552 | ev.property = rq.property; |
3557 | ev.property = rq.property; |
3553 | } |
3558 | } |
3554 | else if (rq.target == XA_STRING |
3559 | else if (rq.target == XA_STRING |
3555 | || rq.target == xa[XA_TEXT] |
3560 | || rq.target == xa[XA_TEXT] |
… | |
… | |
3613 | ct.value = (unsigned char *)rxvt_wcstoutf8 (cl, selectlen); |
3618 | ct.value = (unsigned char *)rxvt_wcstoutf8 (cl, selectlen); |
3614 | ct.nitems = strlen ((char *)ct.value); |
3619 | ct.nitems = strlen ((char *)ct.value); |
3615 | } |
3620 | } |
3616 | else |
3621 | else |
3617 | #endif |
3622 | #endif |
3618 | if (XwcTextListToTextProperty (disp, &cl, 1, (XICCEncodingStyle) style, &ct) >= 0) |
3623 | if (XwcTextListToTextProperty (xdisp, &cl, 1, (XICCEncodingStyle) style, &ct) >= 0) |
3619 | freect = 1; |
3624 | freect = 1; |
3620 | else |
3625 | else |
3621 | { |
3626 | { |
3622 | /* if we failed to convert then send it raw */ |
3627 | /* if we failed to convert then send it raw */ |
3623 | ct.value = (unsigned char *)cl; |
3628 | ct.value = (unsigned char *)cl; |
3624 | ct.nitems = selectlen; |
3629 | ct.nitems = selectlen; |
3625 | ct.encoding = target; |
3630 | ct.encoding = target; |
3626 | } |
3631 | } |
3627 | |
3632 | |
3628 | XChangeProperty (disp, rq.requestor, rq.property, |
3633 | XChangeProperty (xdisp, rq.requestor, rq.property, |
3629 | ct.encoding, 8, PropModeReplace, |
3634 | ct.encoding, 8, PropModeReplace, |
3630 | ct.value, (int)ct.nitems); |
3635 | ct.value, (int)ct.nitems); |
3631 | ev.property = rq.property; |
3636 | ev.property = rq.property; |
3632 | |
3637 | |
3633 | if (freect) |
3638 | if (freect) |
3634 | XFree (ct.value); |
3639 | XFree (ct.value); |
3635 | } |
3640 | } |
3636 | |
3641 | |
3637 | XSendEvent (disp, rq.requestor, False, 0L, (XEvent *)&ev); |
3642 | XSendEvent (xdisp, rq.requestor, False, 0L, (XEvent *)&ev); |
3638 | } |
3643 | } |
3639 | |
3644 | |
3640 | /* ------------------------------------------------------------------------- * |
3645 | /* ------------------------------------------------------------------------- * |
3641 | * MOUSE ROUTINES * |
3646 | * MOUSE ROUTINES * |
3642 | * ------------------------------------------------------------------------- */ |
3647 | * ------------------------------------------------------------------------- */ |
… | |
… | |
3764 | rxvt_term::scr_overlay_set (int x, int y, const wchar_t *s) NOTHROW |
3769 | rxvt_term::scr_overlay_set (int x, int y, const wchar_t *s) NOTHROW |
3765 | { |
3770 | { |
3766 | while (*s) |
3771 | while (*s) |
3767 | { |
3772 | { |
3768 | text_t t = *s++; |
3773 | text_t t = *s++; |
3769 | int width = wcwidth (t); |
3774 | int width = WCWIDTH (t); |
3770 | |
3775 | |
3771 | while (width--) |
3776 | while (width--) |
3772 | { |
3777 | { |
3773 | scr_overlay_set (x++, y, t); |
3778 | scr_overlay_set (x++, y, t); |
3774 | t = NOCHAR; |
3779 | t = NOCHAR; |