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

Commit ea3bb55

Browse files
committed
add clear all records
1 parent 35576b2 commit ea3bb55

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/ClipboardR/Main.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class ClipboardR : IPlugin, IDisposable, ISettingProvider, ISavable
2626
private const string PinUnicode = "📌";
2727
private Settings _settings = null!;
2828
private string _settingsPath = null!;
29-
private int CurrentScore { get; set; } = 0;
29+
private int CurrentScore { get; set; } = 1;
3030

3131
private PluginInitContext? _context;
3232
private LinkedList<ClipboardData> _dataList = new();
@@ -68,8 +68,20 @@ public List<Result> Query(Query query)
6868
!string.IsNullOrEmpty(i.Text) && i.Text.ToLower().Contains(query.Search.Trim().ToLower())).ToArray();
6969

7070
var results = new List<Result>();
71-
results.AddRange(displayData.Where(cd => cd.Pined).Select(ClipDataToResult));
72-
results.AddRange(displayData.Where(cd => !cd.Pined).Select(ClipDataToResult));
71+
results.AddRange(displayData.Select(ClipDataToResult));
72+
results.Add(new Result()
73+
{
74+
Title="Clear All Records",
75+
SubTitle = "Click to clear all records",
76+
IcoPath = _defaultIconPath,
77+
Score = 1,
78+
Action = _ =>
79+
{
80+
_dataList.Clear();
81+
CurrentScore = 1;
82+
return true;
83+
},
84+
});
7385
return results;
7486
}
7587

0 commit comments

Comments
 (0)