refactor: rewrite searching commit by file path

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-03-11 20:55:39 +08:00
parent fa4d9d24e9
commit 64a41dce39
No known key found for this signature in database
3 changed files with 53 additions and 76 deletions

View file

@ -134,7 +134,7 @@ namespace SourceGit.Views
}
else if (e.Key == Key.Down)
{
if (repo.IsSearchCommitSuggestionOpen)
if (repo.MatchedFilesForSearching is { Count: > 0 })
{
SearchSuggestionBox.Focus(NavigationMethod.Tab);
SearchSuggestionBox.SelectedIndex = 0;
@ -144,12 +144,7 @@ namespace SourceGit.Views
}
else if (e.Key == Key.Escape)
{
if (repo.IsSearchCommitSuggestionOpen)
{
repo.SearchCommitFilterSuggestion.Clear();
repo.IsSearchCommitSuggestionOpen = false;
}
repo.ClearMatchedFilesForSearching();
e.Handled = true;
}
}
@ -369,9 +364,7 @@ namespace SourceGit.Views
if (e.Key == Key.Escape)
{
repo.IsSearchCommitSuggestionOpen = false;
repo.SearchCommitFilterSuggestion.Clear();
repo.ClearMatchedFilesForSearching();
e.Handled = true;
}
else if (e.Key == Key.Enter && SearchSuggestionBox.SelectedItem is string content)