Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit 504fa5b

Browse files
committed
fix the bug of score
1 parent 6fa23bc commit 504fa5b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ClipboardR/Main.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class ClipboardR : IPlugin, IDisposable, ISettingProvider, ISavable
2727
private static Random _random = new();
2828
private Settings _settings = null!;
2929
private string _settingsPath = null!;
30+
private int CurrentScore { get; set; } = 0;
3031

3132
// private readonly InputSimulator inputSimulator = new InputSimulator();
3233
private PluginInitContext? _context;
@@ -91,6 +92,7 @@ public List<Result> Query(Query query)
9192
{
9293
// _context!.API.ShowMsg("Wow");
9394
CopyToClipboard(o);
95+
// Due to the focus will change when open FlowLauncher, this won't work for now
9496
new InputSimulator().Keyboard
9597
.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_V);
9698
return true;
@@ -101,6 +103,7 @@ public List<Result> Query(Query query)
101103

102104
private void _OnClipboardChange(object? sender, SharpClipboard.ClipboardChangedEventArgs e)
103105
{
106+
if (e.Content is null) return;
104107
ClipboardData clipboardData = new ClipboardData
105108
{
106109
Text = "",
@@ -110,7 +113,7 @@ private void _OnClipboardChange(object? sender, SharpClipboard.ClipboardChangedE
110113
IconPath = _defaultIconPath,
111114
Icon = new BitmapImage(new Uri(_defaultIconPath, UriKind.RelativeOrAbsolute)),
112115
PreviewImagePath = _defaultIconPath,
113-
Score = _dataList.Count,
116+
Score = CurrentScore++,
114117
};
115118
switch (e.ContentType)
116119
{

0 commit comments

Comments
 (0)