feature: supports filter submodules (#443)

This commit is contained in:
leo 2024-09-06 09:57:22 +08:00
parent 0e774ee035
commit b1457fe39d
No known key found for this signature in database
9 changed files with 60 additions and 29 deletions

View file

@ -128,15 +128,15 @@
</Border>
</Border>
<!-- Filter Branches -->
<!-- Filter Branches/Tags/Submodules -->
<TextBox Grid.Row="1"
Height="24"
Margin="8,6,4,0"
BorderThickness="1"
CornerRadius="4"
BorderBrush="{DynamicResource Brush.Border2}"
Watermark="{DynamicResource Text.Repository.SearchBranchTag}"
Text="{Binding SearchBranchFilter, Mode=TwoWay}"
Watermark="{DynamicResource Text.Repository.Filter}"
Text="{Binding Filter, Mode=TwoWay}"
VerticalContentAlignment="Center">
<TextBox.InnerLeftContent>
<Path Width="14" Height="14"
@ -149,8 +149,8 @@
<Button Classes="icon_button"
Width="16"
Margin="0,0,6,0"
Command="{Binding ClearSearchBranchFilter}"
IsVisible="{Binding SearchBranchFilter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Command="{Binding ClearFilter}"
IsVisible="{Binding Filter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
HorizontalAlignment="Right">
<Path Width="14" Height="14"
Margin="0,1,0,0"
@ -253,7 +253,7 @@
Height="0"
Margin="8,0,4,0"
Classes="repo_left_content_list"
ItemsSource="{Binding Submodules}"
ItemsSource="{Binding VisibleSubmodules}"
SelectionMode="Single"
ContextRequested="OnSubmoduleContextRequested"
DoubleTapped="OnDoubleTappedSubmodule"

View file

@ -252,7 +252,7 @@ namespace SourceGit.Views
var remoteBranchRows = vm.IsRemoteGroupExpanded ? RemoteBranchTree.Rows.Count : 0;
var desiredBranches = (localBranchRows + remoteBranchRows) * 24.0;
var desiredTag = vm.IsTagGroupExpanded ? 24.0 * TagsList.Rows : 0;
var desiredSubmodule = vm.IsSubmoduleGroupExpanded ? 24.0 * vm.Submodules.Count : 0;
var desiredSubmodule = vm.IsSubmoduleGroupExpanded ? 24.0 * vm.VisibleSubmodules.Count : 0;
var desiredWorktree = vm.IsWorktreeGroupExpanded ? 24.0 * vm.Worktrees.Count : 0;
var desiredOthers = desiredTag + desiredSubmodule + desiredWorktree;
var hasOverflow = (desiredBranches + desiredOthers > leftHeight);