|
1 | | -import { |
2 | | - decodePasteBytes, |
3 | | - stripAnsiSequences, |
4 | | - TextAttributes, |
5 | | -} from '@opentui/core' |
| 1 | +import { TextAttributes } from '@opentui/core' |
6 | 2 | import { useAppContext, useKeyboard, useRenderer } from '@opentui/react' |
7 | 3 | import { |
8 | 4 | forwardRef, |
@@ -31,10 +27,6 @@ import type { |
31 | 27 | TextRenderable, |
32 | 28 | } from '@opentui/core' |
33 | 29 |
|
34 | | -function getPasteText(event: PasteEvent): string { |
35 | | - return stripAnsiSequences(decodePasteBytes(event.bytes)) |
36 | | -} |
37 | | - |
38 | 30 | // Helper functions for text manipulation |
39 | 31 | function findLineStart(text: string, cursor: number): number { |
40 | 32 | let pos = Math.max(0, Math.min(cursor, text.length)) |
@@ -1054,7 +1046,7 @@ export const MultilineInput = forwardRef< |
1054 | 1046 |
|
1055 | 1047 | const handlePaste = (event: PasteEvent) => { |
1056 | 1048 | pasteHandledRef.current = true |
1057 | | - onPasteRef.current(getPasteText(event)) |
| 1049 | + onPasteRef.current(event.text) |
1058 | 1050 | // Reset dedup flag after microtask so scrollbox handler (which fires |
1059 | 1051 | // synchronously after global listeners) sees it as handled, but future |
1060 | 1052 | // paste events are not blocked. |
@@ -1153,7 +1145,7 @@ export const MultilineInput = forwardRef< |
1153 | 1145 | // Backup paste handler: fires if the global keyHandler listener |
1154 | 1146 | // didn't catch this event (dedup prevents double-handling) |
1155 | 1147 | if (pasteHandledRef.current) return |
1156 | | - onPasteRef.current(getPasteText(event)) |
| 1148 | + onPasteRef.current(event.text) |
1157 | 1149 | }} |
1158 | 1150 | onMouseDown={handleMouseDown} |
1159 | 1151 | style={{ |
|
0 commit comments