… | |
… | |
2656 | /* ------------------------------------------------------------------------- */ |
2656 | /* ------------------------------------------------------------------------- */ |
2657 | /* |
2657 | /* |
2658 | * Paste a selection direct to the command fd |
2658 | * Paste a selection direct to the command fd |
2659 | */ |
2659 | */ |
2660 | void |
2660 | void |
2661 | rxvt_term::paste (const unsigned char *data, unsigned int len) |
2661 | rxvt_term::paste (unsigned char *data, unsigned int len) |
2662 | { |
2662 | { |
2663 | unsigned int i, j, n; |
|
|
2664 | unsigned char *ds = (unsigned char *)rxvt_malloc (PASTE_SIZE); |
|
|
2665 | |
|
|
2666 | /* convert normal newline chars into common keyboard Return key sequence */ |
2663 | /* convert normal newline chars into common keyboard Return key sequence */ |
2667 | for (i = 0; i < len; i += PASTE_SIZE) |
2664 | for (unsigned int i = 0; i < len; i++) |
2668 | { |
|
|
2669 | n = min (len - i, PASTE_SIZE); |
|
|
2670 | memcpy (ds, data + i, n); |
|
|
2671 | |
|
|
2672 | for (j = 0; j < n; j++) |
|
|
2673 | if (ds[j] == C0_LF) |
2665 | if (data[i] == C0_LF) |
2674 | ds[j] = C0_CR; |
2666 | data[i] = C0_CR; |
2675 | |
2667 | |
2676 | tt_write (ds, (int)n); |
2668 | tt_write (data, len); |
2677 | } |
|
|
2678 | |
|
|
2679 | free (ds); |
|
|
2680 | } |
2669 | } |
2681 | |
2670 | |
2682 | /* ------------------------------------------------------------------------- */ |
2671 | /* ------------------------------------------------------------------------- */ |
2683 | /* |
2672 | /* |
2684 | * Respond to a notification that a primary selection has been sent |
2673 | * Respond to a notification that a primary selection has been sent |