enhance: show suggestion popup after search commit filter type changed

This commit is contained in:
leo 2024-10-18 10:43:04 +08:00
parent 1277112a5e
commit 2cfa2bf6c5
No known key found for this signature in database

View file

@ -2056,7 +2056,31 @@ namespace SourceGit.ViewModels
Task.Run(() =>
{
var files = new Commands.QueryCurrentRevisionFiles(_fullpath).Result();
Dispatcher.UIThread.Invoke(() => _revisionFiles.AddRange(files));
Dispatcher.UIThread.Invoke(() =>
{
if (_searchCommitFilterType != 3)
return;
_revisionFiles.AddRange(files);
if (!string.IsNullOrEmpty(_searchCommitFilter) && _searchCommitFilter.Length > 2 && _revisionFiles.Count > 0)
{
var suggestion = new List<string>();
foreach (var file in _revisionFiles)
{
if (file.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase) && file.Length != _searchCommitFilter.Length)
{
suggestion.Add(file);
if (suggestion.Count > 100)
break;
}
}
SearchCommitFilterSuggestion.Clear();
SearchCommitFilterSuggestion.AddRange(suggestion);
IsSearchCommitSuggestionOpen = SearchCommitFilterSuggestion.Count > 0;
}
});
});
}
}