diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 18fc336758c..0bc9d443725 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -66,6 +66,8 @@ Open Windows Index Option Excluded File Types (comma seperated) For example: exe,jpg,png + Maximum results + The maximum number of results requested from active search engine Explorer diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs index 7186acff5b4..6c9155539fe 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs @@ -64,7 +64,11 @@ public async IAsyncEnumerable SearchAsync(string search, [Enumerat if (token.IsCancellationRequested) yield break; - var option = new EverythingSearchOption(search, Settings.SortOption, IsFullPathSearch: Settings.EverythingSearchFullPath, IsRunCounterEnabled: Settings.EverythingEnableRunCount); + var option = new EverythingSearchOption(search, + Settings.SortOption, + MaxCount: Settings.MaxResult, + IsFullPathSearch: Settings.EverythingSearchFullPath, + IsRunCounterEnabled: Settings.EverythingEnableRunCount); await foreach (var result in EverythingApi.SearchAsync(option, token)) yield return result; @@ -96,6 +100,7 @@ public async IAsyncEnumerable ContentSearchAsync(string plainSearc Settings.SortOption, IsContentSearch: true, ContentSearchKeyword: contentSearch, + MaxCount: Settings.MaxResult, IsFullPathSearch: Settings.EverythingSearchFullPath, IsRunCounterEnabled: Settings.EverythingEnableRunCount); @@ -116,6 +121,7 @@ public async IAsyncEnumerable EnumerateAsync(string path, string s Settings.SortOption, ParentPath: path, IsRecursive: recursive, + MaxCount: Settings.MaxResult, IsFullPathSearch: Settings.EverythingSearchFullPath, IsRunCounterEnabled: Settings.EverythingEnableRunCount); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 729e05ba0f4..309f7a6f7ac 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -525,6 +525,19 @@ public string ExcludedFileTypes } } + public int MaxResultLowerLimit => 100; + public int MaxResultUpperLimit => 100000; + + public int MaxResult + { + get => Settings.MaxResult; + set + { + Settings.MaxResult = Math.Clamp(value, MaxResultLowerLimit, MaxResultUpperLimit); + OnPropertyChanged(); + } + } + #region Everything FastSortWarning diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index caad341c80b..001859caaf0 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -282,6 +282,7 @@ + + + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs index d0483ea8d44..b7f5efc3cc7 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks; +using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks; using Flow.Launcher.Plugin.Explorer.ViewModels; using System.Collections.Generic; using System.ComponentModel; @@ -40,7 +40,7 @@ public ExplorerSettings(SettingsViewModel viewModel) } - + private void AccessLinkDragDrop(string containerName, DragEventArgs e) { var files = (string[])e.Data.GetData(DataFormats.FileDrop); @@ -94,5 +94,10 @@ private void LbxExcludedPaths_OnDrop(object sender, DragEventArgs e) { AccessLinkDragDrop("IndexSearchExcludedPath", e); } + + private void AllowOnlyNumericInput(object sender, System.Windows.Input.TextCompositionEventArgs e) + { + e.Handled = e.Text.ToCharArray().Any(c => !char.IsDigit(c)); + } } }