Skip to content

Commit 2174fc2

Browse files
committed
update directory navigation with same action keyword
1 parent fc9805f commit 2174fc2

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

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

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

24-
private static string GetPathWithActionKeyword(string path, ResultType type)
24+
private static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword)
2525
{
26-
var keyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
26+
string keyword;
27+
// Using Quick Access or Index Search action keywords to then navigate to directory
28+
if (actionKeyword == Settings.PathSearchActionKeyword || actionKeyword == Settings.SearchActionKeyword)
29+
{
30+
keyword = actionKeyword == Settings.PathSearchActionKeyword ? $"{actionKeyword} " : string.Empty;
31+
}
32+
else
33+
{
34+
keyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
2735
? $"{Settings.PathSearchActionKeyword} "
2836
: Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign
2937
? string.Empty // Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used
3038
: $"{Settings.SearchActionKeyword} ";
39+
}
3140

3241
var formatted_path = path;
3342

@@ -42,7 +51,7 @@ private static string GetAutoCompleteText(string title, Query query, string path
4251
{
4352
return !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
4453
? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario
45-
: GetPathWithActionKeyword(path, resultType);
54+
: GetPathWithActionKeyword(path, resultType, query.ActionKeyword);
4655
}
4756

4857
public static Result CreateResult(Query query, SearchResult result)
@@ -83,7 +92,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
8392
}
8493
}
8594

86-
Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder));
95+
Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, query.ActionKeyword));
8796

8897
return false;
8998
},
@@ -118,7 +127,7 @@ internal static Result CreateDriveSpaceDisplayResult(string path, string actionK
118127
{
119128
Title = title,
120129
SubTitle = subtitle,
121-
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder),
130+
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, actionKeyword),
122131
IcoPath = path,
123132
Score = 500,
124133
ProgressBar = progressValue,
@@ -199,7 +208,7 @@ internal static Result CreateOpenCurrentFolderResult(string path, string actionK
199208
Title = title,
200209
SubTitle = $"Use > to search within {subtitleFolderName}, " +
201210
$"* to search for file extensions or >* to combine both searches.",
202-
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder),
211+
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder, actionKeyword),
203212
IcoPath = folderPath,
204213
Score = 500,
205214
CopyText = folderPath,

0 commit comments

Comments
 (0)