From 0a9eb09d7e869ded6ea7530425fcf006f3fa1c98 Mon Sep 17 00:00:00 2001
From: Garulf <535299+Garulf@users.noreply.github.com>
Date: Sun, 4 Feb 2024 11:40:54 -0500
Subject: [PATCH 1/3] Add DeepCopy method
---
Flow.Launcher.Plugin/Result.cs | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs
index bfb0b04110a..fc6c5d185d8 100644
--- a/Flow.Launcher.Plugin/Result.cs
+++ b/Flow.Launcher.Plugin/Result.cs
@@ -183,6 +183,31 @@ public override string ToString()
return Title + SubTitle + Score;
}
+ ///
+ /// Clones the current result
+ ///
+ public Result Clone()
+ {
+ return new Result
+ {
+ Title = Title,
+ SubTitle = SubTitle,
+ ActionKeywordAssigned = ActionKeywordAssigned,
+ CopyText = CopyText,
+ AutoCompleteText = AutoCompleteText,
+ IcoPath = IcoPath,
+ RoundedIcon = RoundedIcon,
+ Icon = Icon,
+ Glyph = Glyph,
+ Action = Action,
+ AsyncAction = AsyncAction,
+ Score = Score,
+ TitleHighlightData = TitleHighlightData,
+ OriginQuery = OriginQuery,
+ PluginDirectory = PluginDirectory
+ };
+ }
+
///
/// Additional data associated with this result
///
From 62a26ff0ca8e6ef62c47ff6d26e1a4f8fc5302f3 Mon Sep 17 00:00:00 2001
From: Garulf <535299+Garulf@users.noreply.github.com>
Date: Sun, 4 Feb 2024 11:41:42 -0500
Subject: [PATCH 2/3] Move copying to appropiate sections
---
Flow.Launcher/ViewModel/MainViewModel.cs | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index db481d4109e..ef533ed319f 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -662,19 +662,7 @@ private void QueryContextMenu()
if (selected == lastContextMenuResult)
{
// Use copy to keep the original results unchanged
- results = lastContextMenuResults.ConvertAll(result => new Result
- {
- Title = result.Title,
- SubTitle = result.SubTitle,
- IcoPath = result.IcoPath,
- PluginDirectory = result.PluginDirectory,
- Action = result.Action,
- ContextData = result.ContextData,
- Glyph = result.Glyph,
- OriginQuery = result.OriginQuery,
- Score = result.Score,
- AsyncAction = result.AsyncAction,
- });
+ results = lastContextMenuResults.ToList();
}
else
{
@@ -689,7 +677,7 @@ private void QueryContextMenu()
if (!string.IsNullOrEmpty(query))
{
- var filtered = results.Where
+ var filtered = results.Select(x => x.Clone()).Where
(
r =>
{
From 3b8fc29d6f913e0762ba819779190e3c72db6432 Mon Sep 17 00:00:00 2001
From: Garulf <535299+Garulf@users.noreply.github.com>
Date: Sun, 4 Feb 2024 11:46:57 -0500
Subject: [PATCH 3/3] Remove unused code
---
Flow.Launcher/ViewModel/MainViewModel.cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index ef533ed319f..9717f40e15c 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -661,8 +661,7 @@ private void QueryContextMenu()
List results;
if (selected == lastContextMenuResult)
{
- // Use copy to keep the original results unchanged
- results = lastContextMenuResults.ToList();
+ results = lastContextMenuResults;
}
else
{