Merge pull request #702 from Flow-Launcher/PluginHotkeyRequery

Implement Requery option and requery when calling customQueryHotkey
This commit is contained in:
Jeremy Wu 2021-09-27 14:06:03 +10:00 committed by GitHub
commit 25b4e2bc6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 9 deletions

View file

@ -110,7 +110,7 @@ namespace Flow.Launcher.Helper
return;
mainViewModel.MainWindowVisibility = Visibility.Visible;
mainViewModel.ChangeQueryText(hotkey.ActionKeyword);
mainViewModel.ChangeQueryText(hotkey.ActionKeyword, true);
});
}

View file

@ -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()

View file

@ -285,9 +285,17 @@ namespace Flow.Launcher.ViewModel
/// but we don't want to move cursor to end when query is updated from TextBox
/// </summary>
/// <param name="queryText"></param>
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;
}