Skip to content

Commit 442ccff

Browse files
committed
[wrap-text] Fix clipboard race condition after paste
Add 200ms delay between Clipboard.paste() and restoring previous clipboard content. Without the delay, the clipboard is restored before the target app processes the Cmd+V keystroke, causing wrong content to be pasted. Regression from #25993. Fixes #26579
1 parent 81d5254 commit 442ccff

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

extensions/wrap-text/src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export async function wrapSelectedText(left: string, right: string = left) {
1515
const previousClipboard = await Clipboard.read();
1616

1717
await Clipboard.paste(wrapped);
18+
await new Promise((resolve) => setTimeout(resolve, 200));
1819

1920
// Restore the previous clipboard content.
2021
if (previousClipboard.text !== undefined) {

0 commit comments

Comments
 (0)