Show the window before slow location probes and wrap git.exe for commit, diff, and merge.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 16:31:56 +02:00
parent a3c54bbb03
commit 9efb306979
42 changed files with 3184 additions and 77 deletions

View File

@@ -0,0 +1,60 @@
<Window x:Class="Explorer.App.GitDiffWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{Binding Title}"
Icon="pack://application:,,,/Assets/explorer-workbench.ico"
Height="640" Width="860"
MinHeight="360" MinWidth="520"
WindowStartupLocation="CenterOwner"
Background="{DynamicResource Bg}" Foreground="{DynamicResource Fg}">
<DockPanel Margin="16">
<Button DockPanel.Dock="Bottom" Content="Close" MinWidth="88" Height="32" HorizontalAlignment="Right"
IsCancel="True" Margin="0,12,0,0"/>
<TextBlock DockPanel.Dock="Top" Text="{Binding EmptyText}" Margin="0,0,0,8"
Foreground="{DynamicResource FgMuted}" TextWrapping="Wrap"
Visibility="{Binding ShowEmpty, Converter={StaticResource BoolVis}}"/>
<ListBox ItemsSource="{Binding Lines}" FontFamily="Consolas" FontSize="13"
Background="{DynamicResource InputBg}" BorderBrush="{DynamicResource Stroke}"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.VirtualizationMode="Recycling">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Focusable" Value="False"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Text}" FontFamily="Consolas" Padding="8,1" TextWrapping="NoWrap">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource Fg}"/>
<Setter Property="Background" Value="Transparent"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Kind}" Value="Added">
<Setter Property="Foreground" Value="{DynamicResource GitDiffAdded}"/>
<Setter Property="Background" Value="{DynamicResource GitDiffAddedBg}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Kind}" Value="Removed">
<Setter Property="Foreground" Value="{DynamicResource GitDiffRemoved}"/>
<Setter Property="Background" Value="{DynamicResource GitDiffRemovedBg}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Kind}" Value="Hunk">
<Setter Property="Foreground" Value="{DynamicResource GitDiffHunk}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Kind}" Value="Meta">
<Setter Property="Foreground" Value="{DynamicResource FgMuted}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</Window>