… | |
… | |
722 | last_col = ncol; |
722 | last_col = ncol; |
723 | |
723 | |
724 | if (nlines > 0) |
724 | if (nlines > 0) |
725 | { |
725 | { |
726 | nlines += screen.cur.row - screen.bscroll; |
726 | nlines += screen.cur.row - screen.bscroll; |
|
|
727 | |
727 | if (nlines > 0 |
728 | if (nlines > 0 |
728 | && screen.tscroll == 0 |
729 | && screen.tscroll == 0 |
729 | && screen.bscroll == (nrow - 1)) |
730 | && screen.bscroll == (nrow - 1)) |
730 | { |
731 | { |
731 | /* _at least_ this many lines need to be scrolled */ |
732 | /* _at least_ this many lines need to be scrolled */ |
… | |
… | |
2107 | if (wlen < len) |
2108 | if (wlen < len) |
2108 | ::swap (wlen, len); |
2109 | ::swap (wlen, len); |
2109 | |
2110 | |
2110 | XCopyArea (display->display, vt, vt, |
2111 | XCopyArea (display->display, vt, vt, |
2111 | gc, 0, Row2Pixel (len + i), |
2112 | gc, 0, Row2Pixel (len + i), |
2112 | (unsigned int)TermWin_TotalWidth (), |
2113 | (unsigned int)this->width, |
2113 | (unsigned int)Height2Pixel (wlen - len + 1), |
2114 | (unsigned int)Height2Pixel (wlen - len + 1), |
2114 | 0, Row2Pixel (len)); |
2115 | 0, Row2Pixel (len)); |
2115 | len = -1; |
2116 | len = -1; |
2116 | } |
2117 | } |
2117 | } |
2118 | } |
… | |
… | |
2564 | /* ------------------------------------------------------------------------- */ |
2565 | /* ------------------------------------------------------------------------- */ |
2565 | /* |
2566 | /* |
2566 | * Paste a selection direct to the command fd |
2567 | * Paste a selection direct to the command fd |
2567 | */ |
2568 | */ |
2568 | void |
2569 | void |
2569 | rxvt_term::paste (unsigned char *data, unsigned int len) |
2570 | rxvt_term::paste (char *data, unsigned int len) |
2570 | { |
2571 | { |
2571 | /* convert normal newline chars into common keyboard Return key sequence */ |
2572 | /* convert normal newline chars into common keyboard Return key sequence */ |
2572 | for (unsigned int i = 0; i < len; i++) |
2573 | for (unsigned int i = 0; i < len; i++) |
2573 | if (data[i] == C0_LF) |
2574 | if (data[i] == C0_LF) |
2574 | data[i] = C0_CR; |
2575 | data[i] = C0_CR; |
… | |
… | |
2718 | { |
2719 | { |
2719 | wchar_t *w = rxvt_utf8towcs ((const char *)ct.value, ct.nitems); |
2720 | wchar_t *w = rxvt_utf8towcs ((const char *)ct.value, ct.nitems); |
2720 | char *s = rxvt_wcstombs (w); |
2721 | char *s = rxvt_wcstombs (w); |
2721 | free (w); |
2722 | free (w); |
2722 | // TODO: strlen == only the first element will be converted. well... |
2723 | // TODO: strlen == only the first element will be converted. well... |
2723 | paste ((unsigned char *)s, strlen (s)); |
2724 | paste (s, strlen (s)); |
2724 | free (s); |
2725 | free (s); |
2725 | } |
2726 | } |
2726 | else |
2727 | else |
2727 | #endif |
2728 | #endif |
2728 | if (XmbTextPropertyToTextList (display->display, &ct, &cl, &cr) >= 0 |
2729 | if (XmbTextPropertyToTextList (display->display, &ct, &cl, &cr) >= 0 |
2729 | && cl) |
2730 | && cl) |
2730 | { |
2731 | { |
2731 | for (int i = 0; i < cr; i++) |
2732 | for (int i = 0; i < cr; i++) |
2732 | paste ((unsigned char *)cl[i], strlen (cl[i])); |
2733 | paste (cl[i], strlen (cl[i])); |
2733 | |
2734 | |
2734 | XFreeStringList (cl); |
2735 | XFreeStringList (cl); |
2735 | } |
2736 | } |
2736 | else |
2737 | else |
2737 | paste (ct.value, ct.nitems); // paste raw |
2738 | paste ((char *)ct.value, ct.nitems); // paste raw |
2738 | |
2739 | |
2739 | bailout: |
2740 | bailout: |
2740 | XFree (ct.value); |
2741 | XFree (ct.value); |
2741 | |
2742 | |
2742 | if (selection_wait == Sel_normal) |
2743 | if (selection_wait == Sel_normal) |
… | |
… | |
2780 | return; /* outside window */ |
2781 | return; /* outside window */ |
2781 | |
2782 | |
2782 | if (selection.text) |
2783 | if (selection.text) |
2783 | { /* internal selection */ |
2784 | { /* internal selection */ |
2784 | char *str = rxvt_wcstombs (selection.text, selection.len); |
2785 | char *str = rxvt_wcstombs (selection.text, selection.len); |
2785 | paste ((unsigned char *)str, strlen (str)); |
2786 | paste (str, strlen (str)); |
2786 | free (str); |
2787 | free (str); |
2787 | return; |
2788 | return; |
2788 | } |
2789 | } |
2789 | else |
2790 | else |
2790 | { |
2791 | { |
… | |
… | |
3136 | } |
3137 | } |
3137 | } |
3138 | } |
3138 | break; |
3139 | break; |
3139 | } |
3140 | } |
3140 | |
3141 | |
3141 | Old_Word_Selection_You_Die: |
|
|
3142 | if (dirn == DN) |
3142 | if (dirn == DN) |
3143 | col++; /* put us on one past the end */ |
3143 | col++; /* put us on one past the end */ |
3144 | |
3144 | |
3145 | /* Poke the values back in */ |
3145 | /* Poke the values back in */ |
3146 | ret->row = row; |
3146 | ret->row = row; |