From 45483809c50ec35ce448d95a53348a51eff5bee3 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 21:44:56 +1000 Subject: [PATCH] Update RemoveActionKeyword method Update the method to handle removal when a plugin has multiple ActionKeywords ie. mix of global and non-global ActionKeywords --- Wox.Core/Plugin/PluginManager.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index ecbf9e3905..97b260114e 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -289,14 +289,20 @@ namespace Wox.Core.Plugin public static void RemoveActionKeyword(string id, string oldActionkeyword) { var plugin = GetPluginForId(id); - if (oldActionkeyword == Query.GlobalPluginWildcardSign) + if (oldActionkeyword == Query.GlobalPluginWildcardSign + && // Plugins may have multiple ActionKeywords that are global, eg. WebSearch + plugin.Metadata.ActionKeywords + .Where(x => x == Query.GlobalPluginWildcardSign) + .ToList() + .Count == 1) { GlobalPlugins.Remove(plugin); } - else - { + + if(oldActionkeyword != Query.GlobalPluginWildcardSign) NonGlobalPlugins.Remove(oldActionkeyword); - } + + plugin.Metadata.ActionKeywords.Remove(oldActionkeyword); }