mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #863 from Garulf/add-auto-complete-to-file-explorer
This commit is contained in:
commit
efd2b78e38
2 changed files with 21 additions and 7 deletions
|
|
@ -20,6 +20,21 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
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 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
Title = title,
|
||||
IcoPath = path,
|
||||
SubTitle = subtitle,
|
||||
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder),
|
||||
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
|
||||
Action = c =>
|
||||
{
|
||||
|
|
@ -43,13 +59,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
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 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
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 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
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 =>
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in a new issue