diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 662425492..309f7a6f7 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -525,12 +525,15 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels } } + public int MaxResultLowerLimit => 100; + public int MaxResultUpperLimit => 100000; + public int MaxResult { get => Settings.MaxResult; set { - Settings.MaxResult = Math.Clamp(value, 100, 10000); + Settings.MaxResult = Math.Clamp(value, MaxResultLowerLimit, MaxResultUpperLimit); OnPropertyChanged(); } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 716ffebd9..bb19fef6e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -363,6 +363,7 @@ Margin="0,9,0,6" HorizontalAlignment="Left" VerticalAlignment="Center" + PreviewTextInput="AllowOnlyNumericInput" Text="{Binding MaxResult}" ToolTip="{DynamicResource plugin_explorer_Maximum_Results_Tooltip}"/> diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs index d0483ea8d..b7f5efc3c 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 @@ namespace Flow.Launcher.Plugin.Explorer.Views } - + private void AccessLinkDragDrop(string containerName, DragEventArgs e) { var files = (string[])e.Data.GetData(DataFormats.FileDrop); @@ -94,5 +94,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views { AccessLinkDragDrop("IndexSearchExcludedPath", e); } + + private void AllowOnlyNumericInput(object sender, System.Windows.Input.TextCompositionEventArgs e) + { + e.Handled = e.Text.ToCharArray().Any(c => !char.IsDigit(c)); + } } }