1
- using Flow . Launcher . Core . Resource ;
1
+ using Flow . Launcher . Core . Resource ;
2
2
using Flow . Launcher . Infrastructure ;
3
3
using Flow . Launcher . Plugin . SharedCommands ;
4
4
using System ;
@@ -38,6 +38,13 @@ private static string GetPathWithActionKeyword(string path, ResultType type)
38
38
return $ "{ keyword } { formatted_path } ";
39
39
}
40
40
41
+ private static string GetAutoCompleteText ( string title , Query query , string path , ResultType resultType )
42
+ {
43
+ return ! Settings . PathSearchKeywordEnabled && ! Settings . SearchActionKeywordEnabled
44
+ ? $ "{ query . ActionKeyword } { title } " // Only Quick Access action keyword is used in this scenario
45
+ : GetPathWithActionKeyword ( path , resultType ) ;
46
+ }
47
+
41
48
public static Result CreateResult ( Query query , SearchResult result )
42
49
{
43
50
return result . Type switch
@@ -57,9 +64,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
57
64
Title = title ,
58
65
IcoPath = path ,
59
66
SubTitle = Path . GetDirectoryName ( path ) ,
60
- AutoCompleteText = ! Settings . PathSearchKeywordEnabled && ! Settings . SearchActionKeywordEnabled
61
- ? $ "{ query . ActionKeyword } { title } " // Only Quick Access action keyword is used in this scenario
62
- : GetPathWithActionKeyword ( path , ResultType . Folder ) ,
67
+ AutoCompleteText = GetAutoCompleteText ( title , query , path , ResultType . Folder ) ,
63
68
TitleHighlightData = StringMatcher . FuzzySearch ( query . Search , title ) . MatchData ,
64
69
CopyText = path ,
65
70
Action = c =>
@@ -219,14 +224,16 @@ internal static Result CreateFileResult(string filePath, Query query, int score
219
224
PreviewImagePath = filePath ,
220
225
} : Result . PreviewInfo . Default ;
221
226
227
+ var title = Path . GetFileName ( filePath ) ;
228
+
222
229
var result = new Result
223
230
{
224
- Title = Path . GetFileName ( filePath ) ,
231
+ Title = title ,
225
232
SubTitle = Path . GetDirectoryName ( filePath ) ,
226
233
IcoPath = filePath ,
227
234
Preview = preview ,
228
- AutoCompleteText = GetPathWithActionKeyword ( filePath , ResultType . File ) ,
229
- TitleHighlightData = StringMatcher . FuzzySearch ( query . Search , Path . GetFileName ( filePath ) ) . MatchData ,
235
+ AutoCompleteText = GetAutoCompleteText ( title , query , filePath , ResultType . File ) ,
236
+ TitleHighlightData = StringMatcher . FuzzySearch ( query . Search , title ) . MatchData ,
230
237
Score = score ,
231
238
CopyText = filePath ,
232
239
Action = c =>
0 commit comments