Skip to content

Commit 25b4e2b

Browse files
authored
Merge pull request #702 from Flow-Launcher/PluginHotkeyRequery
Implement Requery option and requery when calling customQueryHotkey
2 parents d37f848 + 0123f5e commit 25b4e2b

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Flow.Launcher/Helper/HotKeyMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ internal static void SetCustomQueryHotkey(CustomPluginHotkey hotkey)
110110
return;
111111

112112
mainViewModel.MainWindowVisibility = Visibility.Visible;
113-
mainViewModel.ChangeQueryText(hotkey.ActionKeyword);
113+
mainViewModel.ChangeQueryText(hotkey.ActionKeyword, true);
114114
});
115115
}
116116

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@ public PublicAPIInstance(SettingWindowViewModel settingsVM, MainViewModel mainVM
4848

4949
public void ChangeQuery(string query, bool requery = false)
5050
{
51-
_mainVM.ChangeQueryText(query);
52-
}
53-
54-
public void ChangeQueryText(string query, bool selectAll = false)
55-
{
56-
_mainVM.ChangeQueryText(query);
51+
_mainVM.ChangeQueryText(query, requery);
5752
}
5853

5954
public void RestartApp()

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,17 @@ public string QueryText
285285
/// but we don't want to move cursor to end when query is updated from TextBox
286286
/// </summary>
287287
/// <param name="queryText"></param>
288-
public void ChangeQueryText(string queryText)
288+
public void ChangeQueryText(string queryText, bool reQuery = false)
289289
{
290-
QueryText = queryText;
290+
if (QueryText!=queryText)
291+
{
292+
// re-query is done in QueryText's setter method
293+
QueryText = queryText;
294+
}
295+
else if (reQuery)
296+
{
297+
Query();
298+
}
291299
QueryTextCursorMovedToEnd = true;
292300
}
293301

0 commit comments

Comments
 (0)