Skip to content

Commit 4862950

Browse files
Merge branch 'dev' into fix_dup_results_explorer
2 parents 3b8e786 + 184799a commit 4862950

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@ 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-
// one of it is enabled
27-
var keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword;
28-
29-
keyword = keyword == Query.GlobalPluginWildcardSign ? string.Empty : keyword + " ";
26+
// Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used
27+
var keyword = actionKeyword != string.Empty ? actionKeyword + " " : string.Empty;
3028

3129
var formatted_path = path;
3230

3331
if (type == ResultType.Folder)
32+
// the seperator is needed so when navigating the folder structure contents of the folder are listed
3433
formatted_path = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator;
3534

3635
return $"{keyword}{formatted_path}";
@@ -55,7 +54,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
5554
Title = title,
5655
IcoPath = path,
5756
SubTitle = Path.GetDirectoryName(path),
58-
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder),
57+
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, query.ActionKeyword),
5958
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
6059
CopyText = path,
6160
Action = c =>
@@ -74,7 +73,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
7473
}
7574
}
7675

77-
Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder));
76+
Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, query.ActionKeyword));
7877

7978
return false;
8079
},
@@ -90,7 +89,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
9089
};
9190
}
9291

93-
internal static Result CreateDriveSpaceDisplayResult(string path, bool windowsIndexed = false)
92+
internal static Result CreateDriveSpaceDisplayResult(string path, string actionKeyword, bool windowsIndexed = false)
9493
{
9594
var progressBarColor = "#26a0da";
9695
var title = string.Empty; // hide title when use progress bar,
@@ -109,7 +108,7 @@ internal static Result CreateDriveSpaceDisplayResult(string path, bool windowsIn
109108
{
110109
Title = title,
111110
SubTitle = subtitle,
112-
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder),
111+
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, actionKeyword),
113112
IcoPath = path,
114113
Score = 500,
115114
ProgressBar = progressValue,
@@ -166,7 +165,7 @@ private static string ToReadableSize(long pDrvSize, int pi)
166165
return returnStr;
167166
}
168167

169-
internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIndexed = false)
168+
internal static Result CreateOpenCurrentFolderResult(string path, string actionKeyword, bool windowsIndexed = false)
170169
{
171170
// Path passed from PathSearchAsync ends with Constants.DirectorySeperator ('\'), need to remove the seperator
172171
// so it's consistent with folder results returned by index search which does not end with one
@@ -190,7 +189,7 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn
190189
Title = title,
191190
SubTitle = $"Use > to search within {subtitleFolderName}, " +
192191
$"* to search for file extensions or >* to combine both searches.",
193-
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder),
192+
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder, actionKeyword),
194193
IcoPath = folderPath,
195194
Score = 500,
196195
CopyText = folderPath,
@@ -221,7 +220,7 @@ internal static Result CreateFileResult(string filePath, Query query, int score
221220
SubTitle = Path.GetDirectoryName(filePath),
222221
IcoPath = filePath,
223222
Preview = preview,
224-
AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File),
223+
AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File, query.ActionKeyword),
225224
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData,
226225
Score = score,
227226
CopyText = filePath,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ private async Task<List<Result>> PathSearchAsync(Query query, CancellationToken
176176
var retrievedDirectoryPath = FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath);
177177

178178
results.Add(retrievedDirectoryPath.EndsWith(":\\")
179-
? ResultManager.CreateDriveSpaceDisplayResult(retrievedDirectoryPath, useIndexSearch)
180-
: ResultManager.CreateOpenCurrentFolderResult(retrievedDirectoryPath, useIndexSearch));
179+
? ResultManager.CreateDriveSpaceDisplayResult(retrievedDirectoryPath, query.ActionKeyword, useIndexSearch)
180+
: ResultManager.CreateOpenCurrentFolderResult(retrievedDirectoryPath, query.ActionKeyword, useIndexSearch));
181181

182182
if (token.IsCancellationRequested)
183183
return new List<Result>();

0 commit comments

Comments
 (0)