mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
feature: enhance commit search
* Supports search commits by author/committer email * Auto focus when search panel is visible
This commit is contained in:
parent
f65dc36e62
commit
d0e80be79f
3 changed files with 12 additions and 2 deletions
|
@ -292,7 +292,9 @@ namespace SourceGit.ViewModels {
|
|||
|| c.Subject.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase)
|
||||
|| c.Message.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase)
|
||||
|| c.Author.Name.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase)
|
||||
|| c.Committer.Name.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase)) {
|
||||
|| c.Committer.Name.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase)
|
||||
|| c.Author.Email.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase)
|
||||
|| c.Committer.Email.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase)) {
|
||||
visible.Add(c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -346,10 +346,11 @@
|
|||
</Grid>
|
||||
|
||||
<!-- Left Search Mode -->
|
||||
<Grid Grid.Column="0" RowDefinitions="32,*" IsVisible="{Binding IsSearching}">
|
||||
<Grid Grid.Column="0" RowDefinitions="32,*" IsVisible="{Binding IsSearching}" PropertyChanged="OnSearchCommitPanelPropertyChanged">
|
||||
<!-- Search -->
|
||||
<Grid Grid.Row="0" Margin="4,2">
|
||||
<TextBox Grid.Column="1"
|
||||
x:Name="txtSearchCommitsBox"
|
||||
Padding="22,0"
|
||||
FontSize="12"
|
||||
Height="24"
|
||||
|
|
|
@ -88,6 +88,13 @@ namespace SourceGit.Views {
|
|||
}
|
||||
}
|
||||
|
||||
private void OnSearchCommitPanelPropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e) {
|
||||
var grid = sender as Grid;
|
||||
if (e.Property == IsVisibleProperty && grid.IsVisible) {
|
||||
txtSearchCommitsBox.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSearchKeyDown(object sender, KeyEventArgs e) {
|
||||
if (e.Key == Key.Enter) {
|
||||
if (DataContext is ViewModels.Repository repo) {
|
||||
|
|
Loading…
Reference in a new issue