Skip to content

Commit 4b03aa4

Browse files
authored
Merge pull request #3240 from Jack251970/back_query_results_before_change_query
Fix ChangeQuery & ReQuery Work Issue When Results Are Not From Query Results
2 parents 00468a7 + 0f82246 commit 4b03aa4

File tree

6 files changed

+8
-13
lines changed

6 files changed

+8
-13
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ namespace Flow.Launcher.Plugin
1717
public interface IPublicAPI
1818
{
1919
/// <summary>
20-
/// Change Flow.Launcher query
20+
/// Change Flow.Launcher query.
21+
/// When current results are from context menu or history, it will go back to query results before changing query.
2122
/// </summary>
2223
/// <param name="query">query text</param>
2324
/// <param name="requery">
@@ -299,7 +300,7 @@ public interface IPublicAPI
299300

300301
/// <summary>
301302
/// Reloads the query.
302-
/// This method should run when selected item is from query results.
303+
/// When current results are from context menu or history, it will go back to query results before requerying.
303304
/// </summary>
304305
/// <param name="reselect">Choose the first result after reload if true; keep the last selected result if false. Default is true.</param>
305306
public void ReQuery(bool reselect = true);

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,8 @@ public void ReQuery()
279279

280280
public void ReQuery(bool reselect)
281281
{
282-
if (SelectedIsFromQueryResults())
283-
{
284-
QueryResults(isReQuery: true, reSelect: reselect);
285-
}
282+
BackToQueryResults();
283+
QueryResults(isReQuery: true, reSelect: reselect);
286284
}
287285

288286
[RelayCommand]
@@ -626,6 +624,8 @@ public void ChangeQueryText(string queryText, bool isReQuery = false)
626624
{
627625
Application.Current.Dispatcher.Invoke(() =>
628626
{
627+
BackToQueryResults();
628+
629629
if (QueryText != queryText)
630630
{
631631
// re-query is done in QueryText's setter method
@@ -1291,7 +1291,6 @@ private Result ContextMenuTopMost(Result result)
12911291
{
12921292
_topMostRecord.Remove(result);
12931293
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
1294-
App.API.BackToQueryResults();
12951294
App.API.ReQuery();
12961295
return false;
12971296
}
@@ -1309,7 +1308,6 @@ private Result ContextMenuTopMost(Result result)
13091308
{
13101309
_topMostRecord.AddOrUpdate(result);
13111310
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
1312-
App.API.BackToQueryResults();
13131311
App.API.ReQuery();
13141312
return false;
13151313
}

Flow.Launcher/ViewModel/PluginViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,4 @@ private void SetActionKeywords()
159159
changeKeywordsWindow.ShowDialog();
160160
}
161161
}
162-
163162
}

Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public List<Result> LoadContextMenus(Result selectedResult)
5959
var link = pluginManifestInfo.UrlSourceCode.StartsWith("https://github.com")
6060
? Regex.Replace(pluginManifestInfo.UrlSourceCode, @"\/tree\/\w+$", "") + "/issues"
6161
: pluginManifestInfo.UrlSourceCode;
62-
6362
Context.API.OpenUrl(link);
6463
return true;
6564
}

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ public List<Result> LoadContextMenus(Result selectedResult)
292292
Context.API.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_success"),
293293
Context.API.GetTranslation(
294294
"flowlauncher_plugin_program_disable_dlgtitle_success_message"));
295-
Context.API.BackToQueryResults();
296295
Context.API.ReQuery();
297296
return false;
298297
},

Plugins/Flow.Launcher.Plugin.Shell/Main.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.IO;
66
using System.Linq;
77
using System.Threading.Tasks;
8-
using System.Windows;
98
using WindowsInput;
109
using WindowsInput.Native;
1110
using Flow.Launcher.Infrastructure.Hotkey;
@@ -379,7 +378,7 @@ bool API_GlobalKeyboardEvent(int keyevent, int vkcode, SpecialKeyState state)
379378
private void OnWinRPressed()
380379
{
381380
// show the main window and set focus to the query box
382-
Task.Run(() =>
381+
_ = Task.Run(() =>
383382
{
384383
context.API.ShowMainWindow();
385384
context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeparator}");

0 commit comments

Comments
 (0)