From 7d164517ca762cf9fa9108919437396c50dfb13d Mon Sep 17 00:00:00 2001 From: z1nc0r3 Date: Sun, 18 Dec 2022 13:45:02 +0530 Subject: [PATCH 01/14] #1678 Add "hh:mm:ss tt" to clock formats. --- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index a97a328e6..ae8c9d9aa 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -477,7 +477,8 @@ namespace Flow.Launcher.ViewModel "tt h:mm", "tt hh:mm", "h:mm tt", - "hh:mm tt" + "hh:mm tt", + "hh:mm:ss tt" }; public List DateFormatList { get; } = new() From 8fbf7a852695dd3e5e2dd0746fc3dc7d81af2b6b Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 19 Dec 2022 10:56:49 +0900 Subject: [PATCH 02/14] Add Time sec format --- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index ae8c9d9aa..c0188fd5a 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -478,7 +478,8 @@ namespace Flow.Launcher.ViewModel "tt hh:mm", "h:mm tt", "hh:mm tt", - "hh:mm:ss tt" + "hh:mm:ss tt", + "HH:mm:ss tt" }; public List DateFormatList { get; } = new() From af0050e6696243e17e8c9bbe6f34453fe99286e1 Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 21 Dec 2022 22:16:33 +0900 Subject: [PATCH 03/14] Remove Hiding the Disabled menu Item --- Flow.Launcher/Resources/CustomControlTemplate.xaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Flow.Launcher/Resources/CustomControlTemplate.xaml b/Flow.Launcher/Resources/CustomControlTemplate.xaml index 1031ab32d..505b7c2a3 100644 --- a/Flow.Launcher/Resources/CustomControlTemplate.xaml +++ b/Flow.Launcher/Resources/CustomControlTemplate.xaml @@ -2999,8 +2999,6 @@ - - From f0b7898f8971b89617c66d0716e5ed0627cae2dc Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 22 Dec 2022 22:04:39 +1100 Subject: [PATCH 04/14] fix quick access path search and autocomplete text --- .../Search/ResultManager.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 88bfecc14..6669cbf76 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -49,12 +49,20 @@ namespace Flow.Launcher.Plugin.Explorer.Search internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false) { + var pathSearchActionKeyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled + ? Settings.PathSearchActionKeyword + : Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign + ? string.Empty + : Settings.SearchActionKeyword; + return new Result { Title = title, IcoPath = path, SubTitle = Path.GetDirectoryName(path), - AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, query.ActionKeyword), + AutoCompleteText = !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled + ? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario + : GetPathWithActionKeyword(path, ResultType.Folder, pathSearchActionKeyword), TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, CopyText = path, Action = c => @@ -73,7 +81,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search } } - Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, query.ActionKeyword)); + Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, pathSearchActionKeyword)); return false; }, From 5c1cc79751be790e8cddf02b93e787ce747faef6 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 22 Dec 2022 22:39:24 +1100 Subject: [PATCH 05/14] update GetPathWithActionKeyword --- .../Search/ResultManager.cs | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 6669cbf76..224deb417 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -21,10 +21,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search Settings = settings; } - private static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword) + private static string GetPathWithActionKeyword(string path, ResultType type) { - // Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used - var keyword = actionKeyword != string.Empty ? actionKeyword + " " : string.Empty; + var keyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled + ? $"{Settings.PathSearchActionKeyword} " + : Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign + ? string.Empty // Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used + : $"{Settings.SearchActionKeyword} "; var formatted_path = path; @@ -49,12 +52,6 @@ namespace Flow.Launcher.Plugin.Explorer.Search internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false) { - var pathSearchActionKeyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled - ? Settings.PathSearchActionKeyword - : Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign - ? string.Empty - : Settings.SearchActionKeyword; - return new Result { Title = title, @@ -62,7 +59,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search SubTitle = Path.GetDirectoryName(path), AutoCompleteText = !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled ? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario - : GetPathWithActionKeyword(path, ResultType.Folder, pathSearchActionKeyword), + : GetPathWithActionKeyword(path, ResultType.Folder), TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, CopyText = path, Action = c => @@ -81,7 +78,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search } } - Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, pathSearchActionKeyword)); + Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder)); return false; }, @@ -116,7 +113,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search { Title = title, SubTitle = subtitle, - AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, actionKeyword), + AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder), IcoPath = path, Score = 500, ProgressBar = progressValue, @@ -197,7 +194,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search Title = title, SubTitle = $"Use > to search within {subtitleFolderName}, " + $"* to search for file extensions or >* to combine both searches.", - AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder, actionKeyword), + AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder), IcoPath = folderPath, Score = 500, CopyText = folderPath, @@ -228,7 +225,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search SubTitle = Path.GetDirectoryName(filePath), IcoPath = filePath, Preview = preview, - AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File, query.ActionKeyword), + AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File), TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData, Score = score, CopyText = filePath, From fc9805f29ed18efb7b52fc327d891e548e08cc95 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 22 Dec 2022 22:57:37 +1100 Subject: [PATCH 06/14] add GetAutoCompleteText method --- .../Search/ResultManager.cs | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 224deb417..53e1de767 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Core.Resource; +using Flow.Launcher.Core.Resource; using Flow.Launcher.Infrastructure; using Flow.Launcher.Plugin.SharedCommands; using System; @@ -38,6 +38,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search return $"{keyword}{formatted_path}"; } + private static string GetAutoCompleteText(string title, Query query, string path, ResultType resultType) + { + return !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled + ? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario + : GetPathWithActionKeyword(path, resultType); + } + public static Result CreateResult(Query query, SearchResult result) { return result.Type switch @@ -57,9 +64,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search Title = title, IcoPath = path, SubTitle = Path.GetDirectoryName(path), - AutoCompleteText = !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled - ? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario - : GetPathWithActionKeyword(path, ResultType.Folder), + AutoCompleteText = GetAutoCompleteText(title, query, path, ResultType.Folder), TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, CopyText = path, Action = c => @@ -219,14 +224,16 @@ namespace Flow.Launcher.Plugin.Explorer.Search PreviewImagePath = filePath, } : Result.PreviewInfo.Default; + var title = Path.GetFileName(filePath); + var result = new Result { - Title = Path.GetFileName(filePath), + Title = title, SubTitle = Path.GetDirectoryName(filePath), IcoPath = filePath, Preview = preview, - AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File), - TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData, + AutoCompleteText = GetAutoCompleteText(title, query, filePath, ResultType.File), + TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, Score = score, CopyText = filePath, Action = c => From 2174fc24cee3e6826d8affc0e02a222a105ec336 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 22 Dec 2022 23:20:37 +1100 Subject: [PATCH 07/14] update directory navigation with same action keyword --- .../Search/ResultManager.cs | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 53e1de767..69df2764d 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -21,13 +21,22 @@ namespace Flow.Launcher.Plugin.Explorer.Search Settings = settings; } - private static string GetPathWithActionKeyword(string path, ResultType type) + private static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword) { - var keyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled + string keyword; + // Using Quick Access or Index Search action keywords to then navigate to directory + if (actionKeyword == Settings.PathSearchActionKeyword || actionKeyword == Settings.SearchActionKeyword) + { + keyword = actionKeyword == Settings.PathSearchActionKeyword ? $"{actionKeyword} " : string.Empty; + } + else + { + keyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled ? $"{Settings.PathSearchActionKeyword} " : Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign ? string.Empty // Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used : $"{Settings.SearchActionKeyword} "; + } var formatted_path = path; @@ -42,7 +51,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search { return !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled ? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario - : GetPathWithActionKeyword(path, resultType); + : GetPathWithActionKeyword(path, resultType, query.ActionKeyword); } public static Result CreateResult(Query query, SearchResult result) @@ -83,7 +92,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search } } - Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder)); + Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, query.ActionKeyword)); return false; }, @@ -118,7 +127,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search { Title = title, SubTitle = subtitle, - AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder), + AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, actionKeyword), IcoPath = path, Score = 500, ProgressBar = progressValue, @@ -199,7 +208,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search Title = title, SubTitle = $"Use > to search within {subtitleFolderName}, " + $"* to search for file extensions or >* to combine both searches.", - AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder), + AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder, actionKeyword), IcoPath = folderPath, Score = 500, CopyText = folderPath, From cb449667794ddcd5b1e421ca2a7cae219e1b788c Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 22 Dec 2022 21:22:56 +0800 Subject: [PATCH 08/14] Catch exceptions during shortcut expansion --- Flow.Launcher/ViewModel/MainViewModel.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 09bba6e5c..eee7e453a 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -769,8 +769,16 @@ namespace Flow.Launcher.ViewModel { foreach (var shortcut in builtInShortcuts) { - queryBuilder.Replace(shortcut.Key, shortcut.Expand()); - queryBuilderTmp.Replace(shortcut.Key, shortcut.Expand()); + try + { + var expansion = shortcut.Expand(); + queryBuilder.Replace(shortcut.Key, expansion); + queryBuilderTmp.Replace(shortcut.Key, expansion); + } + catch (Exception e) + { + Log.Exception($"{nameof(MainViewModel)}.{nameof(ConstructQuery)}|Error when expanding shortcut {shortcut.Key}", e); + } } }); From fac24285e04147c54873f950055582fcdffc65e8 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 24 Dec 2022 22:50:50 +1100 Subject: [PATCH 09/14] add folder and file get path unit tests --- Flow.Launcher.Test/Plugins/ExplorerTest.cs | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/Flow.Launcher.Test/Plugins/ExplorerTest.cs b/Flow.Launcher.Test/Plugins/ExplorerTest.cs index e0cc9b4c2..94ee85b69 100644 --- a/Flow.Launcher.Test/Plugins/ExplorerTest.cs +++ b/Flow.Launcher.Test/Plugins/ExplorerTest.cs @@ -269,5 +269,65 @@ namespace Flow.Launcher.Test.Plugins // Then Assert.AreEqual(expectedString, resultString); } + + [TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "irrelevant", false, true, "c:\\somefolder\\someotherfolder\\")] + [TestCase("c:\\somefolder\\someotherfolder\\", ResultType.Folder, "irrelevant", true, true, "c:\\somefolder\\someotherfolder\\")] + [TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "irrelevant", true, false, "p c:\\somefolder\\someotherfolder\\")] + [TestCase("c:\\somefolder\\someotherfolder\\", ResultType.Folder, "irrelevant", false, false, "c:\\somefolder\\someotherfolder\\")] + [TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "p", true, false, "p c:\\somefolder\\someotherfolder\\")] + [TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "", true, true, "c:\\somefolder\\someotherfolder\\")] + public void GivenFolderResult_WhenGetPath_ThenPathShouldBeExpectedString( + string path, + ResultType type, + string actionKeyword, + bool pathSearchKeywordEnabled, + bool searchActionKeywordEnabled, + string expectedResult) + { + // Given + var settings = new Settings() + { + PathSearchKeywordEnabled = pathSearchKeywordEnabled, + PathSearchActionKeyword = "p", + SearchActionKeywordEnabled = searchActionKeywordEnabled, + SearchActionKeyword = Query.GlobalPluginWildcardSign + }; + ResultManager.Init(new PluginInitContext(), settings); + + // When + var result = ResultManager.GetPathWithActionKeyword(path, type, actionKeyword); + + // Then + Assert.AreEqual(result, expectedResult); + } + + [TestCase("c:\\somefolder\\somefile", ResultType.File, "irrelevant", false, true, "e c:\\somefolder\\somefile")] + [TestCase("c:\\somefolder\\somefile", ResultType.File, "p", true, false, "p c:\\somefolder\\somefile")] + [TestCase("c:\\somefolder\\somefile", ResultType.File, "e", true, true, "e c:\\somefolder\\somefile")] + [TestCase("c:\\somefolder\\somefile", ResultType.File, "irrelevant", false, false, "e c:\\somefolder\\somefile")] + public void GivenFileResult_WhenGetPath_ThenPathShouldBeExpectedString( + string path, + ResultType type, + string actionKeyword, + bool pathSearchKeywordEnabled, + bool searchActionKeywordEnabled, + string expectedResult) + { + // Given + var settings = new Settings() + { + PathSearchKeywordEnabled = pathSearchKeywordEnabled, + PathSearchActionKeyword = "p", + SearchActionKeywordEnabled = searchActionKeywordEnabled, + SearchActionKeyword = "e" + }; + ResultManager.Init(new PluginInitContext(), settings); + + // When + var result = ResultManager.GetPathWithActionKeyword(path, type, actionKeyword); + + // Then + Assert.AreEqual(result, expectedResult); + } } } From f64ebdca957013f0950b3ac61b1b5e95dd7dad68 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 24 Dec 2022 22:51:09 +1100 Subject: [PATCH 10/14] simplify get path method --- .../Search/ResultManager.cs | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 69df2764d..1d3a57996 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Core.Resource; +using Flow.Launcher.Core.Resource; using Flow.Launcher.Infrastructure; using Flow.Launcher.Plugin.SharedCommands; using System; @@ -21,23 +21,22 @@ namespace Flow.Launcher.Plugin.Explorer.Search Settings = settings; } - private static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword) + public static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword) { - string keyword; - // Using Quick Access or Index Search action keywords to then navigate to directory - if (actionKeyword == Settings.PathSearchActionKeyword || actionKeyword == Settings.SearchActionKeyword) - { - keyword = actionKeyword == Settings.PathSearchActionKeyword ? $"{actionKeyword} " : string.Empty; - } - else - { - keyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled - ? $"{Settings.PathSearchActionKeyword} " - : Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign - ? string.Empty // Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used - : $"{Settings.SearchActionKeyword} "; - } + // actionKeyword will be empty string if using global, query.ActionKeyword is "" + var usePathSearchActionKeyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled; + + var pathSearchActionKeyword = Settings.PathSearchActionKeyword == Query.GlobalPluginWildcardSign + ? string.Empty + : $"{Settings.PathSearchActionKeyword} "; + + var searchActionKeyword = Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign + ? string.Empty + : $"{Settings.SearchActionKeyword} "; + + var keyword = usePathSearchActionKeyword ? pathSearchActionKeyword : searchActionKeyword; + var formatted_path = path; if (type == ResultType.Folder) From 3f2b741dccb8eafcd58c712484ea6b6623d02c67 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sun, 25 Dec 2022 04:58:37 +1100 Subject: [PATCH 11/14] add unit tests for get autocomplete result --- Flow.Launcher.Test/Plugins/ExplorerTest.cs | 64 +++++++++++++++++++ .../Search/ResultManager.cs | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Test/Plugins/ExplorerTest.cs b/Flow.Launcher.Test/Plugins/ExplorerTest.cs index 94ee85b69..36f0294a9 100644 --- a/Flow.Launcher.Test/Plugins/ExplorerTest.cs +++ b/Flow.Launcher.Test/Plugins/ExplorerTest.cs @@ -329,5 +329,69 @@ namespace Flow.Launcher.Test.Plugins // Then Assert.AreEqual(result, expectedResult); } + + [TestCase("somefolder", "c:\\somefolder\\", ResultType.Folder, "q", false, false, "q somefolder")] + [TestCase("somefolder", "c:\\somefolder\\", ResultType.Folder, "i", true, false, "p c:\\somefolder\\")] + [TestCase("somefolder", "c:\\somefolder\\", ResultType.Folder, "irrelevant", true, true, "c:\\somefolder\\")] + public void GivenQueryWithFolderTypeResult_WhenGetAutoComplete_ThenResultShouldBeExpectedString( + string title, + string path, + ResultType resultType, + string actionKeyword, + bool pathSearchKeywordEnabled, + bool searchActionKeywordEnabled, + string expectedResult) + { + // Given + var query = new Query() { ActionKeyword = actionKeyword }; + var settings = new Settings() + { + PathSearchKeywordEnabled = pathSearchKeywordEnabled, + PathSearchActionKeyword = "p", + SearchActionKeywordEnabled = searchActionKeywordEnabled, + SearchActionKeyword = Query.GlobalPluginWildcardSign, + QuickAccessActionKeyword = "q", + IndexSearchActionKeyword = "i" + }; + ResultManager.Init(new PluginInitContext(), settings); + + // When + var result = ResultManager.GetAutoCompleteText(title, query, path, resultType); + + // Then + Assert.AreEqual(result, expectedResult); + } + + [TestCase("somefile", "c:\\somefolder\\somefile", ResultType.File, "q", false, false, "q somefile")] + [TestCase("somefile", "c:\\somefolder\\somefile", ResultType.File, "i", true, false, "p c:\\somefolder\\somefile")] + [TestCase("somefile", "c:\\somefolder\\somefile", ResultType.File, "irrelevant", true, true, "c:\\somefolder\\somefile")] + public void GivenQueryWithFileTypeResult_WhenGetAutoComplete_ThenResultShouldBeExpectedString( + string title, + string path, + ResultType resultType, + string actionKeyword, + bool pathSearchKeywordEnabled, + bool searchActionKeywordEnabled, + string expectedResult) + { + // Given + var query = new Query() { ActionKeyword = actionKeyword }; + var settings = new Settings() + { + QuickAccessActionKeyword = "q", + IndexSearchActionKeyword = "i", + PathSearchActionKeyword = "p", + PathSearchKeywordEnabled = pathSearchKeywordEnabled, + SearchActionKeywordEnabled = searchActionKeywordEnabled, + SearchActionKeyword = Query.GlobalPluginWildcardSign + }; + ResultManager.Init(new PluginInitContext(), settings); + + // When + var result = ResultManager.GetAutoCompleteText(title, query, path, resultType); + + // Then + Assert.AreEqual(result, expectedResult); + } } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 1d3a57996..1e35b7873 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -46,7 +46,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search return $"{keyword}{formatted_path}"; } - private static string GetAutoCompleteText(string title, Query query, string path, ResultType resultType) + public static string GetAutoCompleteText(string title, Query query, string path, ResultType resultType) { return !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled ? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario From b65a32a5254b51204c9d5c116647c1e462e22d89 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sun, 25 Dec 2022 14:05:38 +0800 Subject: [PATCH 12/14] Remove redundant tt --- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index d41f455ba..cb528f354 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -479,7 +479,7 @@ namespace Flow.Launcher.ViewModel "h:mm tt", "hh:mm tt", "hh:mm:ss tt", - "HH:mm:ss tt" + "HH:mm:ss" }; public List DateFormatList { get; } = new() From 8a60fb18a0b6833e64410b7600331e6c87d92877 Mon Sep 17 00:00:00 2001 From: Lasith Manujitha Date: Mon, 26 Dec 2022 10:43:10 +0530 Subject: [PATCH 13/14] WindowsSettings plugin - command updated for diskmgmt --- .../Flow.Launcher.Plugin.WindowsSettings/WindowsSettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/WindowsSettings.json b/Plugins/Flow.Launcher.Plugin.WindowsSettings/WindowsSettings.json index 1d2af9e51..9a0783faf 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/WindowsSettings.json +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/WindowsSettings.json @@ -3419,7 +3419,7 @@ "Name": "CreateAndFormatHardDiskPartitions", "Area": "Unknown", "Type": "TaskLink", - "Command": "%windir%\\system32\\mmc.exe %windir%\\system32\\diskmgmt.msc", + "Command": "%windir%\\system32\\diskmgmt.msc", "Keywords": [ [ "clean-up", From 596c82a7b9159423f08b3bc74961a8b15069e11c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 22:15:20 +0000 Subject: [PATCH 14/14] Bump Microsoft.VisualStudio.Threading from 17.3.44 to 17.4.27 Bumps [Microsoft.VisualStudio.Threading](https://github.com/microsoft/vs-threading) from 17.3.44 to 17.4.27. - [Release notes](https://github.com/microsoft/vs-threading/releases) - [Commits](https://github.com/microsoft/vs-threading/compare/v17.3.44...v17.4.27) --- updated-dependencies: - dependency-name: Microsoft.VisualStudio.Threading dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Flow.Launcher.Infrastructure.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj index fb773f562..80c3bbec5 100644 --- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj +++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj @@ -53,7 +53,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - +