mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-24 19:02:39 +08:00
enhance: clear search results and suggestions after filter was cleared
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -263,12 +263,12 @@ namespace SourceGit.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSearching
|
||||
public bool IsSearchingCommits
|
||||
{
|
||||
get => _isSearching;
|
||||
get => _isSearchingCommits;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _isSearching, value))
|
||||
if (SetProperty(ref _isSearchingCommits, value))
|
||||
{
|
||||
if (value)
|
||||
SelectedViewIndex = 0;
|
||||
@@ -1873,7 +1873,7 @@ namespace SourceGit.ViewModels
|
||||
private int _localChangesCount = 0;
|
||||
private int _stashesCount = 0;
|
||||
|
||||
private bool _isSearching = false;
|
||||
private bool _isSearchingCommits = false;
|
||||
private SearchCommitContext _searchCommitContext = null;
|
||||
|
||||
private string _filter = string.Empty;
|
||||
|
||||
@@ -85,6 +85,8 @@ namespace SourceGit.ViewModels
|
||||
public void ClearFilter()
|
||||
{
|
||||
Filter = string.Empty;
|
||||
Selected = null;
|
||||
Results = null;
|
||||
}
|
||||
|
||||
public void ClearSuggestions()
|
||||
@@ -158,7 +160,7 @@ namespace SourceGit.ViewModels
|
||||
{
|
||||
IsQuerying = false;
|
||||
|
||||
if (_repo.IsSearching)
|
||||
if (_repo.IsSearchingCommits)
|
||||
Results = result;
|
||||
});
|
||||
});
|
||||
@@ -194,7 +196,7 @@ namespace SourceGit.ViewModels
|
||||
{
|
||||
_requestingWorktreeFiles = false;
|
||||
|
||||
if (_repo.IsSearching)
|
||||
if (_repo.IsSearchingCommits)
|
||||
{
|
||||
_worktreeFiles = files;
|
||||
UpdateSuggestions();
|
||||
|
||||
@@ -225,11 +225,11 @@ namespace SourceGit.Views
|
||||
e.Handled = true;
|
||||
return;
|
||||
case Key.F:
|
||||
repo.IsSearching = true;
|
||||
repo.IsSearchingCommits = true;
|
||||
e.Handled = true;
|
||||
return;
|
||||
case Key.H when e.KeyModifiers.HasFlag(KeyModifiers.Shift):
|
||||
repo.IsSearching = false;
|
||||
repo.IsSearchingCommits = false;
|
||||
e.Handled = true;
|
||||
return;
|
||||
case Key.P when e.KeyModifiers.HasFlag(KeyModifiers.Shift):
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<RadioButton Classes="switch_button"
|
||||
Width="48"
|
||||
GroupName="SearchGroup"
|
||||
IsChecked="{Binding !IsSearching, Mode=OneWay}">
|
||||
IsChecked="{Binding !IsSearchingCommits, Mode=OneWay}">
|
||||
<ToolTip.Tip>
|
||||
<TextBlock>
|
||||
<Run Text="{DynamicResource Text.Repository.Dashboard}" Foreground="{DynamicResource Brush.FG1}"/>
|
||||
@@ -37,7 +37,7 @@
|
||||
<RadioButton Classes="switch_button"
|
||||
Width="48"
|
||||
GroupName="SearchGroup"
|
||||
IsChecked="{Binding IsSearching, Mode=TwoWay}">
|
||||
IsChecked="{Binding IsSearchingCommits, Mode=TwoWay}">
|
||||
<ToolTip.Tip>
|
||||
<TextBlock>
|
||||
<Run Text="{DynamicResource Text.Repository.Search}" Foreground="{DynamicResource Brush.FG1}"/>
|
||||
@@ -50,7 +50,7 @@
|
||||
</StackPanel>
|
||||
|
||||
<!-- Dashboard -->
|
||||
<Grid Grid.Row="1" Margin="0,0,0,8" RowDefinitions="Auto,Auto,*" IsVisible="{Binding !IsSearching}">
|
||||
<Grid Grid.Row="1" Margin="0,0,0,8" RowDefinitions="Auto,Auto,*" IsVisible="{Binding !IsSearchingCommits}">
|
||||
<!-- Page Switcher for Right Panel -->
|
||||
<Border Grid.Row="0" Margin="8,0,4,0" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}" CornerRadius="6">
|
||||
<Border CornerRadius="6" ClipToBounds="True">
|
||||
@@ -437,7 +437,7 @@
|
||||
</Grid>
|
||||
|
||||
<!-- Commit Search Panel -->
|
||||
<Grid Grid.Row="1" RowDefinitions="Auto,26,*" Margin="8,0,4,8" IsVisible="{Binding IsSearching}" PropertyChanged="OnSearchCommitPanelPropertyChanged">
|
||||
<Grid Grid.Row="1" RowDefinitions="Auto,26,*" Margin="8,0,4,8" IsVisible="{Binding IsSearchingCommits}" PropertyChanged="OnSearchCommitPanelPropertyChanged">
|
||||
<!-- Search Input Box -->
|
||||
<Grid Grid.Row="0" Height="26" Margin="0,4,0,0">
|
||||
<TextBox x:Name="TxtSearchCommitsBox"
|
||||
|
||||
Reference in New Issue
Block a user