From ff867d22a1edf5d942b49231e9dff575db499092 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Sun, 5 Dec 2021 15:07:32 -0500 Subject: [PATCH 1/6] Initial commit Fix misaligned suggestion text --- Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 241e82efbaf..0e68e681557 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -27,6 +27,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string Title = title, IcoPath = path, SubTitle = subtitle, + AutoCompleteText = $"{subtitle}\\", TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, Action = c => { @@ -123,6 +124,7 @@ internal static Result CreateFileResult(string filePath, Query query, int score Title = Path.GetFileName(filePath), SubTitle = filePath, IcoPath = filePath, + AutoCompleteText = filePath, TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData, Score = score, Action = c => From 3618979774ff9ae1878bc272c1a9eccbfe399281 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Mon, 6 Dec 2021 15:59:36 -0500 Subject: [PATCH 2/6] Bump version --- Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index 07da2ad690a..b9c91d2d1c0 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json @@ -10,7 +10,7 @@ "Name": "Explorer", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Author": "Jeremy Wu", - "Version": "1.10.1", + "Version": "1.10.2", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll", From 34fd11a411a08c55c8ed5cd20f072c855d0d304e Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Mon, 6 Dec 2021 16:08:57 -0500 Subject: [PATCH 3/6] Update Plugins/Flow.Launcher.Plugin.Explorer/plugin.json Co-authored-by: Jeremy Wu --- Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index b9c91d2d1c0..0d2b1069bb0 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json @@ -10,7 +10,7 @@ "Name": "Explorer", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Author": "Jeremy Wu", - "Version": "1.10.2", + "Version": "1.11.0", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll", From 74f97f1b952ddaaa9a675ec369614e76a418c479 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Mon, 6 Dec 2021 16:09:14 -0500 Subject: [PATCH 4/6] Update Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs Co-authored-by: Jeremy Wu --- Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 0e68e681557..4033fad2a45 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -27,7 +27,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string Title = title, IcoPath = path, SubTitle = subtitle, - AutoCompleteText = $"{subtitle}\\", + AutoCompleteText = $"{path}\\", TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, Action = c => { From b201d789d2b1893874ae5cd79b8fbf2c4e49af27 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Mon, 6 Dec 2021 16:57:06 -0500 Subject: [PATCH 5/6] Prepend folder action keyword --- .../Search/ResultManager.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 4033fad2a45..9b77b57a099 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -13,11 +13,19 @@ public static class ResultManager { private static PluginInitContext Context; private static Settings Settings { get; set; } + public static object Keyword { get; private set; } public static void Init(PluginInitContext context, Settings settings) { Context = context; Settings = settings; + Keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword; + Keyword = Keyword.ToString() == Query.GlobalPluginWildcardSign ? string.Empty : Keyword + " "; + } + + public static string ChangeToPath(string path) + { + return path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator; } internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false) @@ -27,7 +35,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string Title = title, IcoPath = path, SubTitle = subtitle, - AutoCompleteText = $"{path}\\", + AutoCompleteText = $"{Keyword}{ChangeToPath(path)}", TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, Action = c => { @@ -44,13 +52,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string return false; } } - // one of it is enabled - var keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword; - - keyword = keyword == Query.GlobalPluginWildcardSign ? string.Empty : keyword + " "; - - string changeTo = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator; - Context.API.ChangeQuery($"{keyword}{changeTo}"); + Context.API.ChangeQuery($"{Keyword}{ChangeToPath(path)}"); return false; }, Score = score, From f741420f952a8fc2915455f396a9dc718c546b7e Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 8 Dec 2021 08:01:16 +1100 Subject: [PATCH 6/6] retrieve path with action keywrod --- .../Search/ResultManager.cs | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 9b77b57a099..63310bebd3a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -13,19 +13,26 @@ public static class ResultManager { private static PluginInitContext Context; private static Settings Settings { get; set; } - public static object Keyword { get; private set; } public static void Init(PluginInitContext context, Settings settings) { Context = context; Settings = settings; - Keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword; - Keyword = Keyword.ToString() == Query.GlobalPluginWildcardSign ? string.Empty : Keyword + " "; } - public static string ChangeToPath(string path) + private static string GetPathWithActionKeyword(string path, ResultType type) { - return path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator; + // one of it is enabled + var keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword; + + keyword = keyword == Query.GlobalPluginWildcardSign ? string.Empty : keyword + " "; + + var formatted_path = path; + + if (type == ResultType.Folder) + formatted_path = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator; + + return $"{keyword}{formatted_path}"; } internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false) @@ -35,7 +42,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string Title = title, IcoPath = path, SubTitle = subtitle, - AutoCompleteText = $"{Keyword}{ChangeToPath(path)}", + AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder), TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, Action = c => { @@ -52,7 +59,9 @@ internal static Result CreateFolderResult(string title, string subtitle, string return false; } } - Context.API.ChangeQuery($"{Keyword}{ChangeToPath(path)}"); + + Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder)); + return false; }, Score = score, @@ -100,6 +109,7 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn Title = title, SubTitle = $"Use > to search within {subtitleFolderName}, " + $"* to search for file extensions or >* to combine both searches.", + AutoCompleteText = GetPathWithActionKeyword(retrievedDirectoryPath, ResultType.Folder), IcoPath = retrievedDirectoryPath, Score = 500, Action = c => @@ -126,7 +136,7 @@ internal static Result CreateFileResult(string filePath, Query query, int score Title = Path.GetFileName(filePath), SubTitle = filePath, IcoPath = filePath, - AutoCompleteText = filePath, + AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File), TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData, Score = score, Action = c =>