| 68 | |
| 69 | // Helper to simulate a full paste event. |
| 70 | paste(text: string) { |
| 71 | if (this.isLegacy) { |
| 72 | const PASTE_START = '\x1B[200~'; |
| 73 | const PASTE_END = '\x1B[201~'; |
| 74 | this.emit('data', Buffer.from(`${PASTE_START}${text}${PASTE_END}`)); |
| 75 | } else { |
| 76 | this.emit('keypress', null, { name: 'paste-start' }); |
| 77 | this.emit('keypress', null, { sequence: text }); |
| 78 | this.emit('keypress', null, { name: 'paste-end' }); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | // Helper to simulate the start of a paste, without the end. |
| 83 | startPaste(text: string) { |