Merge pull request #3240 from Jack251970/back_query_results_before_change_query

Fix ChangeQuery & ReQuery Work Issue When Results Are Not From Query Results
This commit is contained in:
Jeremy Wu 2025-02-23 10:13:11 +11:00 committed by GitHub
commit 4b03aa477c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 8 additions and 13 deletions

View file

@ -17,7 +17,8 @@ namespace Flow.Launcher.Plugin
public interface IPublicAPI
{
/// <summary>
/// Change Flow.Launcher query
/// Change Flow.Launcher query.
/// When current results are from context menu or history, it will go back to query results before changing query.
/// </summary>
/// <param name="query">query text</param>
/// <param name="requery">
@ -299,7 +300,7 @@ namespace Flow.Launcher.Plugin
/// <summary>
/// Reloads the query.
/// This method should run when selected item is from query results.
/// When current results are from context menu or history, it will go back to query results before requerying.
/// </summary>
/// <param name="reselect">Choose the first result after reload if true; keep the last selected result if false. Default is true.</param>
public void ReQuery(bool reselect = true);

View file

@ -279,10 +279,8 @@ namespace Flow.Launcher.ViewModel
public void ReQuery(bool reselect)
{
if (SelectedIsFromQueryResults())
{
QueryResults(isReQuery: true, reSelect: reselect);
}
BackToQueryResults();
QueryResults(isReQuery: true, reSelect: reselect);
}
[RelayCommand]
@ -626,6 +624,8 @@ namespace Flow.Launcher.ViewModel
{
Application.Current.Dispatcher.Invoke(() =>
{
BackToQueryResults();
if (QueryText != queryText)
{
// re-query is done in QueryText's setter method
@ -1291,7 +1291,6 @@ namespace Flow.Launcher.ViewModel
{
_topMostRecord.Remove(result);
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
App.API.BackToQueryResults();
App.API.ReQuery();
return false;
}
@ -1309,7 +1308,6 @@ namespace Flow.Launcher.ViewModel
{
_topMostRecord.AddOrUpdate(result);
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
App.API.BackToQueryResults();
App.API.ReQuery();
return false;
}

View file

@ -159,5 +159,4 @@ namespace Flow.Launcher.ViewModel
changeKeywordsWindow.ShowDialog();
}
}
}

View file

@ -59,7 +59,6 @@ namespace Flow.Launcher.Plugin.PluginsManager
var link = pluginManifestInfo.UrlSourceCode.StartsWith("https://github.com")
? Regex.Replace(pluginManifestInfo.UrlSourceCode, @"\/tree\/\w+$", "") + "/issues"
: pluginManifestInfo.UrlSourceCode;
Context.API.OpenUrl(link);
return true;
}

View file

@ -292,7 +292,6 @@ namespace Flow.Launcher.Plugin.Program
Context.API.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_success"),
Context.API.GetTranslation(
"flowlauncher_plugin_program_disable_dlgtitle_success_message"));
Context.API.BackToQueryResults();
Context.API.ReQuery();
return false;
},

View file

@ -5,7 +5,6 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using WindowsInput;
using WindowsInput.Native;
using Flow.Launcher.Infrastructure.Hotkey;
@ -379,7 +378,7 @@ namespace Flow.Launcher.Plugin.Shell
private void OnWinRPressed()
{
// show the main window and set focus to the query box
Task.Run(() =>
_ = Task.Run(() =>
{
context.API.ShowMainWindow();
context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeparator}");