refactor: commit search (#256)

This commit is contained in:
leo 2024-07-13 22:36:59 +08:00
parent 38c6c7713e
commit 6a8527a394
No known key found for this signature in database
6 changed files with 37 additions and 20 deletions

View file

@ -580,7 +580,9 @@
HorizontalAlignment="Right"
SelectedIndex="{Binding SearchCommitFilterType, Mode=TwoWay}">
<ComboBox.Items>
<TextBlock Text="{DynamicResource Text.Repository.Search.ByBaseInfo}" FontSize="12"/>
<TextBlock Text="{DynamicResource Text.Repository.Search.BySHA}" FontSize="12"/>
<TextBlock Text="{DynamicResource Text.Repository.Search.ByUser}" FontSize="12"/>
<TextBlock Text="{DynamicResource Text.Repository.Search.ByMessage}" FontSize="12"/>
<TextBlock Text="{DynamicResource Text.Repository.Search.ByFile}" FontSize="12"/>
</ComboBox.Items>
</ComboBox>

View file

@ -73,7 +73,7 @@ namespace SourceGit.Views
{
if (e.Key == Key.Enter)
{
if (DataContext is ViewModels.Repository repo)
if (DataContext is ViewModels.Repository repo && !string.IsNullOrWhiteSpace(repo.SearchCommitFilter))
repo.StartSearchCommits();
e.Handled = true;