From e13c64725d7fe7bdd51aeb6592a57b3efff3c894 Mon Sep 17 00:00:00 2001 From: Kevin Zhang <45326534+taooceros@users.noreply.github.com> Date: Fri, 24 Sep 2021 20:05:55 -0500 Subject: [PATCH 1/3] Implement Requery option and requery when calling customQueryHotkey --- Flow.Launcher/Helper/HotKeyMapper.cs | 2 +- Flow.Launcher/PublicAPIInstance.cs | 7 +------ Flow.Launcher/ViewModel/MainViewModel.cs | 11 +++++++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index d5fcabace..4d871b345 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -110,7 +110,7 @@ namespace Flow.Launcher.Helper 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 f3403696e..6f995671d 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -48,12 +48,7 @@ namespace Flow.Launcher 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 6eee51bd8..b5eec4972 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -285,9 +285,16 @@ namespace Flow.Launcher.ViewModel /// 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) { - QueryText = queryText; + if (QueryText!=queryText) + { + QueryText = queryText; + } + else if (reQuery) + { + Query(); + } QueryTextCursorMovedToEnd = true; } From 54b5966e410a601f244e978b673a36a871dc5ff2 Mon Sep 17 00:00:00 2001 From: Kevin Zhang <45326534+taooceros@users.noreply.github.com> Date: Fri, 24 Sep 2021 20:07:01 -0500 Subject: [PATCH 2/3] add default Parameter --- Flow.Launcher/ViewModel/MainViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index b5eec4972..e012a2dfd 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -285,7 +285,7 @@ namespace Flow.Launcher.ViewModel /// but we don't want to move cursor to end when query is updated from TextBox /// /// - public void ChangeQueryText(string queryText, bool reQuery) + public void ChangeQueryText(string queryText, bool reQuery = false) { if (QueryText!=queryText) { From 0123f5e930d9a1a7b6e6c73928ba110f76a34850 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 27 Sep 2021 14:01:14 +1000 Subject: [PATCH 3/3] add comment to clarify re-query --- Flow.Launcher/ViewModel/MainViewModel.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index e012a2dfd..04b5ffede 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -289,6 +289,7 @@ namespace Flow.Launcher.ViewModel { if (QueryText!=queryText) { + // re-query is done in QueryText's setter method QueryText = queryText; } else if (reQuery)