diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index bfb0b0411..fc6c5d185 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -183,6 +183,31 @@ namespace Flow.Launcher.Plugin 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 /// diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index b6483a56e..9b799e582 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -688,20 +688,7 @@ namespace Flow.Launcher.ViewModel List results; 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; } else { @@ -715,7 +702,7 @@ namespace Flow.Launcher.ViewModel if (!string.IsNullOrEmpty(query)) { - var filtered = results.Where + var filtered = results.Select(x => x.Clone()).Where ( r => {