Fix search delay runtime change issue

This commit is contained in:
Jack251970 2025-03-30 20:44:00 +08:00
parent 2273d0cacf
commit 750cba2dde
2 changed files with 20 additions and 4 deletions

View file

@ -330,7 +330,17 @@ namespace Flow.Launcher.Infrastructure.UserSettings
OnPropertyChanged();
}
}
public int SearchDelay { get; set; } = 120;
int searchDelay { get; set; } = 120;
public int SearchDelay
{
get => searchDelay;
set
{
searchDelay = value;
OnPropertyChanged();
}
}
[JsonIgnore]
public List<int> SearchDelayRange { get; } = new()

View file

@ -123,7 +123,7 @@ namespace Flow.Launcher
}
// Initialize search delay
SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay);
SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay, _settings.SearchDelay);
// Initialize place holder
SetupPlaceholderText();
@ -268,7 +268,13 @@ namespace Flow.Launcher
SetupResizeMode();
break;
case nameof(Settings.SearchQueryResultsWithDelay):
SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay);
SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay, _settings.SearchDelay);
break;
case nameof(Settings.SearchDelay):
if (_settings.SearchQueryResultsWithDelay)
{
SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay, _settings.SearchDelay);
}
break;
}
};
@ -1122,7 +1128,7 @@ namespace Flow.Launcher
// Edited from: https://github.com/microsoft/PowerToys
private void SetupSearchTextBoxReactiveness(bool showResultsWithDelay)
private void SetupSearchTextBoxReactiveness(bool showResultsWithDelay, int searchDelay)
{
if (_reactiveSubscription != null)
{