Commit 5546b97
committed
Forward xterm-paste events to the inferior shell
TTY Emacs running inside a host terminal that does bracketed paste
delivers clipboard pastes as a single `(xterm-paste TEXT)` event.
The default `xterm-paste' binding inserts TEXT into the current
buffer, which is useless in a ghostel buffer: the renderer owns
the buffer and wipes any plain-inserted text on the next redraw,
so the shell never sees the paste.
Bind `[xterm-paste]' in `ghostel-mode-map' (and
`ghostel-copy-mode-map') to a new `ghostel-xterm-paste' handler
that pulls the text out of the event and forwards it to the
subprocess via `ghostel--paste-text', the same bracketed-paste
path used by `ghostel-yank' and `ghostel-paste'. When
`xterm-store-paste-on-kill-ring' is non-nil (stock default), also
push the text onto the kill ring for parity with `xterm-paste'.
If copy-mode is active, exit it first so the paste reaches the
prompt.
Covered by seven ERT tests under the existing paste/yank section:
happy path forwards payload to `ghostel--paste-text'; wrong event
type raises `user-error'; nil payload is a no-op; kill-ring is
populated/skipped per `xterm-store-paste-on-kill-ring'; copy-mode
is exited before forwarding; and [xterm-paste] is bound in both
keymaps.
Fixes #172.1 parent c42451e commit 5546b97
3 files changed
Lines changed: 142 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1053 | 1053 | | |
1054 | 1054 | | |
1055 | 1055 | | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
1056 | 1060 | | |
1057 | 1061 | | |
1058 | 1062 | | |
| |||
1445 | 1449 | | |
1446 | 1450 | | |
1447 | 1451 | | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
1448 | 1472 | | |
1449 | 1473 | | |
1450 | 1474 | | |
| |||
1622 | 1646 | | |
1623 | 1647 | | |
1624 | 1648 | | |
1625 | | - | |
1626 | | - | |
1627 | | - | |
1628 | | - | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
1629 | 1654 | | |
1630 | 1655 | | |
1631 | 1656 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6022 | 6022 | | |
6023 | 6023 | | |
6024 | 6024 | | |
| 6025 | + | |
| 6026 | + | |
| 6027 | + | |
| 6028 | + | |
| 6029 | + | |
| 6030 | + | |
| 6031 | + | |
| 6032 | + | |
| 6033 | + | |
| 6034 | + | |
| 6035 | + | |
| 6036 | + | |
| 6037 | + | |
| 6038 | + | |
| 6039 | + | |
| 6040 | + | |
| 6041 | + | |
| 6042 | + | |
| 6043 | + | |
| 6044 | + | |
| 6045 | + | |
| 6046 | + | |
| 6047 | + | |
| 6048 | + | |
| 6049 | + | |
| 6050 | + | |
| 6051 | + | |
| 6052 | + | |
| 6053 | + | |
| 6054 | + | |
| 6055 | + | |
| 6056 | + | |
| 6057 | + | |
| 6058 | + | |
| 6059 | + | |
| 6060 | + | |
| 6061 | + | |
| 6062 | + | |
| 6063 | + | |
| 6064 | + | |
| 6065 | + | |
| 6066 | + | |
| 6067 | + | |
| 6068 | + | |
| 6069 | + | |
| 6070 | + | |
| 6071 | + | |
| 6072 | + | |
| 6073 | + | |
| 6074 | + | |
| 6075 | + | |
| 6076 | + | |
| 6077 | + | |
| 6078 | + | |
| 6079 | + | |
| 6080 | + | |
| 6081 | + | |
| 6082 | + | |
| 6083 | + | |
| 6084 | + | |
| 6085 | + | |
| 6086 | + | |
| 6087 | + | |
| 6088 | + | |
| 6089 | + | |
| 6090 | + | |
| 6091 | + | |
| 6092 | + | |
| 6093 | + | |
| 6094 | + | |
| 6095 | + | |
| 6096 | + | |
| 6097 | + | |
| 6098 | + | |
| 6099 | + | |
| 6100 | + | |
| 6101 | + | |
| 6102 | + | |
| 6103 | + | |
| 6104 | + | |
| 6105 | + | |
| 6106 | + | |
| 6107 | + | |
| 6108 | + | |
| 6109 | + | |
| 6110 | + | |
| 6111 | + | |
| 6112 | + | |
| 6113 | + | |
| 6114 | + | |
| 6115 | + | |
| 6116 | + | |
| 6117 | + | |
| 6118 | + | |
| 6119 | + | |
| 6120 | + | |
| 6121 | + | |
| 6122 | + | |
| 6123 | + | |
| 6124 | + | |
6025 | 6125 | | |
6026 | 6126 | | |
6027 | 6127 | | |
| |||
7036 | 7136 | | |
7037 | 7137 | | |
7038 | 7138 | | |
| 7139 | + | |
| 7140 | + | |
| 7141 | + | |
| 7142 | + | |
| 7143 | + | |
| 7144 | + | |
| 7145 | + | |
| 7146 | + | |
7039 | 7147 | | |
7040 | 7148 | | |
7041 | 7149 | | |
| |||
0 commit comments