mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
update GetPathWithActionKeyword
This commit is contained in:
parent
f0b7898f89
commit
5c1cc79751
1 changed files with 11 additions and 14 deletions
|
|
@ -21,10 +21,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword)
|
private static string GetPathWithActionKeyword(string path, ResultType type)
|
||||||
{
|
{
|
||||||
// Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used
|
var keyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
|
||||||
var keyword = actionKeyword != string.Empty ? actionKeyword + " " : string.Empty;
|
? $"{Settings.PathSearchActionKeyword} "
|
||||||
|
: Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign
|
||||||
|
? string.Empty // Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used
|
||||||
|
: $"{Settings.SearchActionKeyword} ";
|
||||||
|
|
||||||
var formatted_path = path;
|
var formatted_path = path;
|
||||||
|
|
||||||
|
|
@ -49,12 +52,6 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
|
|
||||||
internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false)
|
internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false)
|
||||||
{
|
{
|
||||||
var pathSearchActionKeyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
|
|
||||||
? Settings.PathSearchActionKeyword
|
|
||||||
: Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign
|
|
||||||
? string.Empty
|
|
||||||
: Settings.SearchActionKeyword;
|
|
||||||
|
|
||||||
return new Result
|
return new Result
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
|
|
@ -62,7 +59,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
SubTitle = Path.GetDirectoryName(path),
|
SubTitle = Path.GetDirectoryName(path),
|
||||||
AutoCompleteText = !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
|
AutoCompleteText = !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
|
||||||
? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario
|
? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario
|
||||||
: GetPathWithActionKeyword(path, ResultType.Folder, pathSearchActionKeyword),
|
: GetPathWithActionKeyword(path, ResultType.Folder),
|
||||||
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
|
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
|
||||||
CopyText = path,
|
CopyText = path,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
|
|
@ -81,7 +78,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, pathSearchActionKeyword));
|
Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
@ -116,7 +113,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
SubTitle = subtitle,
|
SubTitle = subtitle,
|
||||||
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, actionKeyword),
|
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder),
|
||||||
IcoPath = path,
|
IcoPath = path,
|
||||||
Score = 500,
|
Score = 500,
|
||||||
ProgressBar = progressValue,
|
ProgressBar = progressValue,
|
||||||
|
|
@ -197,7 +194,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(folderPath, ResultType.Folder, actionKeyword),
|
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder),
|
||||||
IcoPath = folderPath,
|
IcoPath = folderPath,
|
||||||
Score = 500,
|
Score = 500,
|
||||||
CopyText = folderPath,
|
CopyText = folderPath,
|
||||||
|
|
@ -228,7 +225,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
SubTitle = Path.GetDirectoryName(filePath),
|
SubTitle = Path.GetDirectoryName(filePath),
|
||||||
IcoPath = filePath,
|
IcoPath = filePath,
|
||||||
Preview = preview,
|
Preview = preview,
|
||||||
AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File, query.ActionKeyword),
|
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,
|
||||||
CopyText = filePath,
|
CopyText = filePath,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue