mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-25 14:15:00 +00:00
refactor: rewrite searching commit by file path
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
fa4d9d24e9
commit
64a41dce39
3 changed files with 53 additions and 76 deletions
|
@ -424,7 +424,7 @@
|
|||
HorizontalOffset="-8" VerticalAlignment="-8">
|
||||
<Popup.IsOpen>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="IsSearchCommitSuggestionOpen"/>
|
||||
<Binding Path="MatchedFilesForSearching" Converter="{x:Static c:ListConverters.IsNotNullOrEmpty}"/>
|
||||
<Binding Path="$parent[Window].IsActive"/>
|
||||
</MultiBinding>
|
||||
</Popup.IsOpen>
|
||||
|
@ -434,7 +434,7 @@
|
|||
<ListBox x:Name="SearchSuggestionBox"
|
||||
Background="Transparent"
|
||||
SelectionMode="Single"
|
||||
ItemsSource="{Binding SearchCommitFilterSuggestion}"
|
||||
ItemsSource="{Binding MatchedFilesForSearching}"
|
||||
MaxHeight="400"
|
||||
Focusable="True"
|
||||
KeyDown="OnSearchSuggestionBoxKeyDown">
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue