Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit 4e4b932

Browse files
committed
Added delays before resetting the clipboard
There were cases where the Paste input would occur after the clipboard was reset with the original text. Adding the delay makes sure the right text is pasted.
1 parent c815fe4 commit 4e4b932

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/Sidekick.Business/Chat/ChatService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public async Task Write(string text)
3535
await clipboard.SetText(text);
3636

3737
keyboard.SendInput("Enter");
38+
keyboard.SendInput("Ctrl+A");
3839
keyboard.Paste();
3940
keyboard.SendInput("Enter");
4041
keyboard.SendInput("Enter");
@@ -44,6 +45,7 @@ public async Task Write(string text)
4445

4546
if (settings.RetainClipboard)
4647
{
48+
await Task.Delay(100);
4749
await clipboard.SetText(clipboardValue);
4850
}
4951

@@ -61,10 +63,12 @@ public async Task StartWriting(string text)
6163
await clipboard.SetText(text);
6264

6365
keyboard.SendInput("Enter");
66+
keyboard.SendInput("Ctrl+A");
6467
keyboard.Paste();
6568

6669
if (settings.RetainClipboard)
6770
{
71+
await Task.Delay(100);
6872
await clipboard.SetText(clipboardValue);
6973
}
7074

src/Sidekick.Core/Natives/NativeClipboard.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public async Task<string> Copy()
3636

3737
if (settings.RetainClipboard)
3838
{
39+
await Task.Delay(100);
3940
await TextCopy.Clipboard.SetTextAsync(clipboardText);
4041
}
4142

0 commit comments

Comments
 (0)