Merge pull request #2529 from Flow-Launcher/improve-context-menu-results-2

Improve context menu results
This commit is contained in:
Kevin Zhang 2024-03-31 11:49:16 -05:00 committed by GitHub
commit 4721b9758b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 15 deletions

View file

@ -183,6 +183,31 @@ namespace Flow.Launcher.Plugin
return Title + SubTitle + Score;
}
/// <summary>
/// Clones the current result
/// </summary>
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
};
}
/// <summary>
/// Additional data associated with this result
/// </summary>

View file

@ -688,20 +688,7 @@ namespace Flow.Launcher.ViewModel
List<Result> 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 =>
{