Skip to content

Commit 63593e1

Browse files
authored
[wrap-text] Fix clipboard race condition after paste (#26760)
* [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 * [wrap-text] Add changelog entry for clipboard race fix
1 parent 2ebe473 commit 63593e1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

extensions/wrap-text/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Wrap Text Changelog
22

3+
## [Fix] - 2026-03-30
4+
5+
- Fix clipboard race condition: add delay before restoring previous clipboard content
36
## [Initial Version] - 2026-03-23
47

58
- Added 6 individual wrap commands: Brackets, Single Quotes, Double Quotes, Curly Brackets, Parentheses, and Wrap with Custom Characters
69
- Each command can be assigned its own hotkey in Raycast
710
- Clipboard is preserved after wrapping
8-
- Shared `wrap` and `wrapSelectedText` utilities to reduce code duplication
11+
- Shared `wrap` and `wrapSelectedText` utilities to reduce code duplication

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)