Skip to content

Commit 5c1cc79

Browse files
committed
update GetPathWithActionKeyword
1 parent f0b7898 commit 5c1cc79

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ public static void Init(PluginInitContext context, Settings settings)
2121
Settings = settings;
2222
}
2323

24-
private static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword)
24+
private static string GetPathWithActionKeyword(string path, ResultType type)
2525
{
26-
// Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used
27-
var keyword = actionKeyword != string.Empty ? actionKeyword + " " : string.Empty;
26+
var keyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
27+
? $"{Settings.PathSearchActionKeyword} "
28+
: Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign
29+
? string.Empty // Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used
30+
: $"{Settings.SearchActionKeyword} ";
2831

2932
var formatted_path = path;
3033

@@ -49,20 +52,14 @@ public static Result CreateResult(Query query, SearchResult result)
4952

5053
internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false)
5154
{
52-
var pathSearchActionKeyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
53-
? Settings.PathSearchActionKeyword
54-
: Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign
55-
? string.Empty
56-
: Settings.SearchActionKeyword;
57-
5855
return new Result
5956
{
6057
Title = title,
6158
IcoPath = path,
6259
SubTitle = Path.GetDirectoryName(path),
6360
AutoCompleteText = !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
6461
? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario
65-
: GetPathWithActionKeyword(path, ResultType.Folder, pathSearchActionKeyword),
62+
: GetPathWithActionKeyword(path, ResultType.Folder),
6663
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
6764
CopyText = path,
6865
Action = c =>
@@ -81,7 +78,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
8178
}
8279
}
8380

84-
Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, pathSearchActionKeyword));
81+
Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder));
8582

8683
return false;
8784
},
@@ -116,7 +113,7 @@ internal static Result CreateDriveSpaceDisplayResult(string path, string actionK
116113
{
117114
Title = title,
118115
SubTitle = subtitle,
119-
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, actionKeyword),
116+
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder),
120117
IcoPath = path,
121118
Score = 500,
122119
ProgressBar = progressValue,
@@ -197,7 +194,7 @@ internal static Result CreateOpenCurrentFolderResult(string path, string actionK
197194
Title = title,
198195
SubTitle = $"Use > to search within {subtitleFolderName}, " +
199196
$"* to search for file extensions or >* to combine both searches.",
200-
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder, actionKeyword),
197+
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder),
201198
IcoPath = folderPath,
202199
Score = 500,
203200
CopyText = folderPath,
@@ -228,7 +225,7 @@ internal static Result CreateFileResult(string filePath, Query query, int score
228225
SubTitle = Path.GetDirectoryName(filePath),
229226
IcoPath = filePath,
230227
Preview = preview,
231-
AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File, query.ActionKeyword),
228+
AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File),
232229
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData,
233230
Score = score,
234231
CopyText = filePath,

0 commit comments

Comments
 (0)