diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 241e82efbaf..63310bebd3a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -20,6 +20,21 @@ public static void Init(PluginInitContext context, Settings settings) Settings = settings; } + private static string GetPathWithActionKeyword(string path, ResultType type) + { + // 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) { return new Result @@ -27,6 +42,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string Title = title, IcoPath = path, SubTitle = subtitle, + AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder), TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, Action = c => { @@ -43,13 +59,9 @@ 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(GetPathWithActionKeyword(path, ResultType.Folder)); + return false; }, Score = score, @@ -97,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 => @@ -123,6 +136,7 @@ internal static Result CreateFileResult(string filePath, Query query, int score Title = Path.GetFileName(filePath), SubTitle = filePath, IcoPath = filePath, + AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File), TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData, Score = score, Action = c => diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index 07da2ad690a..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.1", + "Version": "1.11.0", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",