From 319db64393dde56afa3b06f83e7700fa84dc07b6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 05:19:00 +0000 Subject: [PATCH 1/2] Initial plan From 531b45210ae2c5d8b68db3e0770b0fa8d00f14df Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 05:40:25 +0000 Subject: [PATCH 2/2] Fix exception when setting Folder Search action keyword in Explorer plugin - Fix (false, false) case in EditActionKeyword to break gracefully instead of throwing ArgumentException. This handles the valid scenario where the user changes a disabled keyword's text but keeps it disabled. - Fix GetActiveActionKeywords to return an empty dictionary instead of null when actionKeywordStr is null/empty, preventing NullReferenceException. - Fix ActionKeyword setter to only auto-enable when the value actually changes, preventing unintended side-effects during construction. - Initialize ActionKeywordSetting backing fields directly in constructor to avoid the auto-enable triggering during initialization. - Change TextBox binding to UpdateSourceTrigger=PropertyChanged so the checkbox auto-enables as the user types (before they click the checkbox), fixing the checkbox toggle issue caused by LostFocus timing. Co-authored-by: Jack251970 <53996452+Jack251970@users.noreply.github.com> --- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 2 +- .../ViewModels/SettingsViewModel.cs | 5 +++-- .../Views/ActionKeywordSetting.xaml | 2 +- .../Views/ActionKeywordSetting.xaml.cs | 11 ++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index e65c03e9b..08e0015d4 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -230,7 +230,7 @@ namespace Flow.Launcher.Plugin.Explorer internal Dictionary GetActiveActionKeywords(string actionKeywordStr) { var result = new Dictionary(); - if (string.IsNullOrEmpty(actionKeywordStr)) return null; + if (string.IsNullOrEmpty(actionKeywordStr)) return result; foreach (var action in Enum.GetValues()) { var keywordStr = GetActionKeyword(action); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 30c2c7f14..a9b2e6a89 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -321,8 +321,9 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels Context.API.AddActionKeyword(Context.CurrentPluginMetadata.ID, actionKeywordWindow.ActionKeyword); break; case (false, false): - throw new ArgumentException( - $"Both false in {nameof(actionKeyword)}.{nameof(actionKeyword.Enabled)} and {nameof(actionKeywordWindow)}.{nameof(actionKeywordWindow.KeywordEnabled)} should suggest that the ShowDialog() result is false"); + // Keyword was disabled and remains disabled, but the keyword text was changed. + // No action keyword registration changes needed; the model will be updated below. + break; } (actionKeyword.Keyword, actionKeyword.Enabled) = (actionKeywordWindow.ActionKeyword, actionKeywordWindow.KeywordEnabled); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml index ae0f91d93..10a701061 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml @@ -82,7 +82,7 @@ VerticalAlignment="Center" DataObject.Pasting="TextBox_Pasting" PreviewKeyDown="TxtCurrentActionKeyword_OnKeyDown" - Text="{Binding ActionKeyword}" /> + Text="{Binding ActionKeyword, UpdateSourceTrigger=PropertyChanged}" /> actionKeyword; set { - // Set Enable to be true if user change ActionKeyword - KeywordEnabled = true; - _ = SetProperty(ref actionKeyword, value); + // Set Enable to be true only when the ActionKeyword value actually changes + if (SetProperty(ref actionKeyword, value)) + KeywordEnabled = true; } } @@ -34,8 +34,9 @@ namespace Flow.Launcher.Plugin.Explorer.Views public ActionKeywordSetting(ActionKeywordModel selectedActionKeyword) { CurrentActionKeyword = selectedActionKeyword; - ActionKeyword = selectedActionKeyword.Keyword; - KeywordEnabled = selectedActionKeyword.Enabled; + // Initialize backing fields directly to avoid triggering the auto-enable side-effect + actionKeyword = selectedActionKeyword.Keyword; + _keywordEnabled = selectedActionKeyword.Enabled; InitializeComponent();