Skip to content

Commit 4721b97

Browse files
authored
Merge pull request #2529 from Flow-Launcher/improve-context-menu-results-2
Improve context menu results
2 parents 62a7d9a + 3b8fc29 commit 4721b97

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

Flow.Launcher.Plugin/Result.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,31 @@ public override string ToString()
183183
return Title + SubTitle + Score;
184184
}
185185

186+
/// <summary>
187+
/// Clones the current result
188+
/// </summary>
189+
public Result Clone()
190+
{
191+
return new Result
192+
{
193+
Title = Title,
194+
SubTitle = SubTitle,
195+
ActionKeywordAssigned = ActionKeywordAssigned,
196+
CopyText = CopyText,
197+
AutoCompleteText = AutoCompleteText,
198+
IcoPath = IcoPath,
199+
RoundedIcon = RoundedIcon,
200+
Icon = Icon,
201+
Glyph = Glyph,
202+
Action = Action,
203+
AsyncAction = AsyncAction,
204+
Score = Score,
205+
TitleHighlightData = TitleHighlightData,
206+
OriginQuery = OriginQuery,
207+
PluginDirectory = PluginDirectory
208+
};
209+
}
210+
186211
/// <summary>
187212
/// Additional data associated with this result
188213
/// </summary>

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -688,20 +688,7 @@ private void QueryContextMenu()
688688
List<Result> results;
689689
if (selected == lastContextMenuResult)
690690
{
691-
// Use copy to keep the original results unchanged
692-
results = lastContextMenuResults.ConvertAll(result => new Result
693-
{
694-
Title = result.Title,
695-
SubTitle = result.SubTitle,
696-
IcoPath = result.IcoPath,
697-
PluginDirectory = result.PluginDirectory,
698-
Action = result.Action,
699-
ContextData = result.ContextData,
700-
Glyph = result.Glyph,
701-
OriginQuery = result.OriginQuery,
702-
Score = result.Score,
703-
AsyncAction = result.AsyncAction,
704-
});
691+
results = lastContextMenuResults;
705692
}
706693
else
707694
{
@@ -715,7 +702,7 @@ private void QueryContextMenu()
715702

716703
if (!string.IsNullOrEmpty(query))
717704
{
718-
var filtered = results.Where
705+
var filtered = results.Select(x => x.Clone()).Where
719706
(
720707
r =>
721708
{

0 commit comments

Comments
 (0)