diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index d5fcabace05..4d871b345fa 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -110,7 +110,7 @@ internal static void SetCustomQueryHotkey(CustomPluginHotkey hotkey) return; mainViewModel.MainWindowVisibility = Visibility.Visible; - mainViewModel.ChangeQueryText(hotkey.ActionKeyword); + mainViewModel.ChangeQueryText(hotkey.ActionKeyword, true); }); } diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index f3403696e05..6f995671dd2 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -48,12 +48,7 @@ public PublicAPIInstance(SettingWindowViewModel settingsVM, MainViewModel mainVM public void ChangeQuery(string query, bool requery = false) { - _mainVM.ChangeQueryText(query); - } - - public void ChangeQueryText(string query, bool selectAll = false) - { - _mainVM.ChangeQueryText(query); + _mainVM.ChangeQueryText(query, requery); } public void RestartApp() diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 6eee51bd883..04b5ffede35 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -285,9 +285,17 @@ public string QueryText /// but we don't want to move cursor to end when query is updated from TextBox /// /// - public void ChangeQueryText(string queryText) + public void ChangeQueryText(string queryText, bool reQuery = false) { - QueryText = queryText; + if (QueryText!=queryText) + { + // re-query is done in QueryText's setter method + QueryText = queryText; + } + else if (reQuery) + { + Query(); + } QueryTextCursorMovedToEnd = true; }