Skip to content

Commit b201d78

Browse files
committed
Prepend folder action keyword
1 parent 74f97f1 commit b201d78

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@ public static class ResultManager
1313
{
1414
private static PluginInitContext Context;
1515
private static Settings Settings { get; set; }
16+
public static object Keyword { get; private set; }
1617

1718
public static void Init(PluginInitContext context, Settings settings)
1819
{
1920
Context = context;
2021
Settings = settings;
22+
Keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword;
23+
Keyword = Keyword.ToString() == Query.GlobalPluginWildcardSign ? string.Empty : Keyword + " ";
24+
}
25+
26+
public static string ChangeToPath(string path)
27+
{
28+
return path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator;
2129
}
2230

2331
internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false)
@@ -27,7 +35,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
2735
Title = title,
2836
IcoPath = path,
2937
SubTitle = subtitle,
30-
AutoCompleteText = $"{path}\\",
38+
AutoCompleteText = $"{Keyword}{ChangeToPath(path)}",
3139
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
3240
Action = c =>
3341
{
@@ -44,13 +52,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
4452
return false;
4553
}
4654
}
47-
// one of it is enabled
48-
var keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword;
49-
50-
keyword = keyword == Query.GlobalPluginWildcardSign ? string.Empty : keyword + " ";
51-
52-
string changeTo = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator;
53-
Context.API.ChangeQuery($"{keyword}{changeTo}");
55+
Context.API.ChangeQuery($"{Keyword}{ChangeToPath(path)}");
5456
return false;
5557
},
5658
Score = score,

0 commit comments

Comments
 (0)