Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Flow.Launcher/Helper/HotKeyMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ internal static void SetCustomQueryHotkey(CustomPluginHotkey hotkey)
return;

mainViewModel.MainWindowVisibility = Visibility.Visible;
mainViewModel.ChangeQueryText(hotkey.ActionKeyword);
mainViewModel.ChangeQueryText(hotkey.ActionKeyword, true);
});
}

Expand Down
7 changes: 1 addition & 6 deletions Flow.Launcher/PublicAPIInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 10 additions & 2 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,17 @@ public string QueryText
/// 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this shouldnt be an 'else if', they should be two seperate statements

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well actually, when QueryText is not equal to queryText, the requery will be triggered. Only when they are the same, we need manually requery.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh it's requeried in the setter method...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets add a comment in to make it clear

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will commit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember it is the optimization from fody xd

{
Query();
}
QueryTextCursorMovedToEnd = true;
}

Expand Down