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;
|
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)
|
internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false)
|
||||||
{
|
{
|
||||||
return new Result
|
return new Result
|
||||||
|
|
@ -27,6 +42,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
Title = title,
|
Title = title,
|
||||||
IcoPath = path,
|
IcoPath = path,
|
||||||
SubTitle = subtitle,
|
SubTitle = subtitle,
|
||||||
|
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder),
|
||||||
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
|
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
|
|
@ -43,13 +59,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// one of it is enabled
|
|
||||||
var keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword;
|
|
||||||
|
|
||||||
keyword = keyword == Query.GlobalPluginWildcardSign ? string.Empty : keyword + " ";
|
Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder));
|
||||||
|
|
||||||
string changeTo = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator;
|
|
||||||
Context.API.ChangeQuery($"{keyword}{changeTo}");
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
Score = score,
|
Score = score,
|
||||||
|
|
@ -97,6 +109,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
Title = title,
|
Title = title,
|
||||||
SubTitle = $"Use > to search within {subtitleFolderName}, " +
|
SubTitle = $"Use > to search within {subtitleFolderName}, " +
|
||||||
$"* to search for file extensions or >* to combine both searches.",
|
$"* to search for file extensions or >* to combine both searches.",
|
||||||
|
AutoCompleteText = GetPathWithActionKeyword(retrievedDirectoryPath, ResultType.Folder),
|
||||||
IcoPath = retrievedDirectoryPath,
|
IcoPath = retrievedDirectoryPath,
|
||||||
Score = 500,
|
Score = 500,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
|
|
@ -123,6 +136,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
Title = Path.GetFileName(filePath),
|
Title = Path.GetFileName(filePath),
|
||||||
SubTitle = filePath,
|
SubTitle = filePath,
|
||||||
IcoPath = filePath,
|
IcoPath = filePath,
|
||||||
|
AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File),
|
||||||
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData,
|
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData,
|
||||||
Score = score,
|
Score = score,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
"Name": "Explorer",
|
"Name": "Explorer",
|
||||||
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
|
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
|
||||||
"Author": "Jeremy Wu",
|
"Author": "Jeremy Wu",
|
||||||
"Version": "1.10.1",
|
"Version": "1.11.0",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue