Skip to content

Commit 2cfa2bf

Browse files
committed
enhance: show suggestion popup after search commit filter type changed
1 parent 1277112 commit 2cfa2bf

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/ViewModels/Repository.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,31 @@ private void UpdateCurrentRevisionFilesForSearchSuggestion()
20562056
Task.Run(() =>
20572057
{
20582058
var files = new Commands.QueryCurrentRevisionFiles(_fullpath).Result();
2059-
Dispatcher.UIThread.Invoke(() => _revisionFiles.AddRange(files));
2059+
Dispatcher.UIThread.Invoke(() =>
2060+
{
2061+
if (_searchCommitFilterType != 3)
2062+
return;
2063+
2064+
_revisionFiles.AddRange(files);
2065+
2066+
if (!string.IsNullOrEmpty(_searchCommitFilter) && _searchCommitFilter.Length > 2 && _revisionFiles.Count > 0)
2067+
{
2068+
var suggestion = new List<string>();
2069+
foreach (var file in _revisionFiles)
2070+
{
2071+
if (file.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase) && file.Length != _searchCommitFilter.Length)
2072+
{
2073+
suggestion.Add(file);
2074+
if (suggestion.Count > 100)
2075+
break;
2076+
}
2077+
}
2078+
2079+
SearchCommitFilterSuggestion.Clear();
2080+
SearchCommitFilterSuggestion.AddRange(suggestion);
2081+
IsSearchCommitSuggestionOpen = SearchCommitFilterSuggestion.Count > 0;
2082+
}
2083+
});
20602084
});
20612085
}
20622086
}

0 commit comments

Comments
 (0)