mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
Change the way to show only space or no changes in DiffViewer
This commit is contained in:
parent
e08b7024fc
commit
087b147dd9
4 changed files with 34 additions and 24 deletions
|
@ -223,15 +223,7 @@ namespace SourceGit.Git {
|
||||||
rs.Add(current);
|
rs.Add(current);
|
||||||
rs.Fit();
|
rs.Fit();
|
||||||
|
|
||||||
if (rs.IsBinary) {
|
if (rs.IsBinary) rs.Blocks.Clear();
|
||||||
rs.Blocks.Clear();
|
|
||||||
} else if (rs.Blocks.Count == 0) {
|
|
||||||
var b = new Block();
|
|
||||||
b.Mode = LineMode.Indicator;
|
|
||||||
b.Append("NO CHANGES OR ONLY WHITESPACE CHANGES!!!");
|
|
||||||
rs.Blocks.Add(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<!-- Enable WindowChrome Feature -->
|
<!-- Enable WindowChrome Feature -->
|
||||||
<WindowChrome.WindowChrome>
|
<WindowChrome.WindowChrome>
|
||||||
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="32" GlassFrameThickness="0 0 0 1" ResizeBorderThickness="8" NonClientFrameEdges="None" />
|
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="32"/>
|
||||||
</WindowChrome.WindowChrome>
|
</WindowChrome.WindowChrome>
|
||||||
|
|
||||||
<!-- Window Layout -->
|
<!-- Window Layout -->
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<Border BorderThickness="1" BorderBrush="{StaticResource Brush.Border2}">
|
<Border BorderThickness="1" BorderBrush="{StaticResource Brush.Border2}">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="26"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
@ -24,7 +24,9 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Grid Grid.Row="1" ClipToBounds="True">
|
<Path x:Name="loading" Grid.Row="0" HorizontalAlignment="Left" Width="10" Height="10" Margin="8,0" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Loading}" Visibility="Collapsed"/>
|
||||||
|
|
||||||
|
<Grid x:Name="textChange" Grid.Row="1" ClipToBounds="True">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" MinWidth="100"/>
|
<ColumnDefinition Width="*" MinWidth="100"/>
|
||||||
<ColumnDefinition Width="2"/>
|
<ColumnDefinition Width="2"/>
|
||||||
|
@ -128,7 +130,7 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Border x:Name="sizer" Grid.Row="1" ClipToBounds="True" Background="{StaticResource Brush.BG3}" Visibility="Collapsed">
|
<Border x:Name="sizeChange" Grid.Row="1" ClipToBounds="True" Background="{StaticResource Brush.BG3}" Visibility="Collapsed">
|
||||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
||||||
<Label Content="BINARY DIFF" Margin="0,0,0,32" FontSize="18" FontWeight="UltraBold" Foreground="{StaticResource Brush.FG2}" HorizontalAlignment="Center"/>
|
<Label Content="BINARY DIFF" Margin="0,0,0,32" FontSize="18" FontWeight="UltraBold" Foreground="{StaticResource Brush.FG2}" HorizontalAlignment="Center"/>
|
||||||
<Path Width="64" Height="64" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Binary}" Fill="{StaticResource Brush.FG2}"/>
|
<Path Width="64" Height="64" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Binary}" Fill="{StaticResource Brush.FG2}"/>
|
||||||
|
@ -151,16 +153,19 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
<Border x:Name="noChange" Grid.Row="1" Background="{StaticResource Brush.BG3}" Visibility="Collapsed">
|
||||||
|
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Opacity=".2">
|
||||||
|
<Path Width="64" Height="64" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Check}"/>
|
||||||
|
<Label Margin="0,8,0,0" Content="SAME OR ONLY EOL CHANGES" FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<Border x:Name="mask" Grid.RowSpan="2" Background="{StaticResource Brush.BG3}" Visibility="Collapsed">
|
<Border x:Name="mask" Grid.RowSpan="2" Background="{StaticResource Brush.BG3}" Visibility="Collapsed">
|
||||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Opacity=".2">
|
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Opacity=".2">
|
||||||
<Path Width="64" Height="64" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Diff}"/>
|
<Path Width="64" Height="64" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Diff}"/>
|
||||||
<Label Margin="0,8,0,0" Content="SELECT FILE TO VIEW CHANGES" FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center"/>
|
<Label Margin="0,8,0,0" Content="SELECT FILE TO VIEW CHANGES" FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Border x:Name="loading" Grid.RowSpan="2" Background="{StaticResource Brush.BG3}" Visibility="Collapsed">
|
|
||||||
<Label Content="LOADING ..." FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource Brush.FG2}"/>
|
|
||||||
</Border>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -38,7 +38,6 @@ namespace SourceGit.UI {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Reset() {
|
public void Reset() {
|
||||||
mask.Visibility = Visibility.Visible;
|
mask.Visibility = Visibility.Visible;
|
||||||
sizer.Visibility = Visibility.Collapsed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -50,7 +49,10 @@ namespace SourceGit.UI {
|
||||||
SetTitle(opts.Path, opts.OrgPath);
|
SetTitle(opts.Path, opts.OrgPath);
|
||||||
|
|
||||||
loading.Visibility = Visibility.Visible;
|
loading.Visibility = Visibility.Visible;
|
||||||
sizer.Visibility = Visibility.Collapsed;
|
mask.Visibility = Visibility.Collapsed;
|
||||||
|
textChange.Visibility = Visibility.Collapsed;
|
||||||
|
sizeChange.Visibility = Visibility.Collapsed;
|
||||||
|
noChange.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
Task.Run(() => {
|
Task.Run(() => {
|
||||||
var args = $"{opts.ExtraArgs} ";
|
var args = $"{opts.ExtraArgs} ";
|
||||||
|
@ -62,9 +64,11 @@ namespace SourceGit.UI {
|
||||||
var rs = Git.Diff.Run(repo, args);
|
var rs = Git.Diff.Run(repo, args);
|
||||||
if (rs.IsBinary) {
|
if (rs.IsBinary) {
|
||||||
SetSizeChangeData(Git.Diff.GetSizeChange(repo, opts.RevisionRange, opts.Path, opts.OrgPath));
|
SetSizeChangeData(Git.Diff.GetSizeChange(repo, opts.RevisionRange, opts.Path, opts.OrgPath));
|
||||||
} else {
|
} else if (rs.Blocks.Count > 0) {
|
||||||
SetData(rs);
|
SetData(rs);
|
||||||
}
|
} else {
|
||||||
|
SetSame();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,13 +95,22 @@ namespace SourceGit.UI {
|
||||||
private void SetSizeChangeData(Git.Diff.BinaryChange bc) {
|
private void SetSizeChangeData(Git.Diff.BinaryChange bc) {
|
||||||
Dispatcher.Invoke(() => {
|
Dispatcher.Invoke(() => {
|
||||||
loading.Visibility = Visibility.Collapsed;
|
loading.Visibility = Visibility.Collapsed;
|
||||||
mask.Visibility = Visibility.Collapsed;
|
sizeChange.Visibility = Visibility.Visible;
|
||||||
sizer.Visibility = Visibility.Visible;
|
|
||||||
txtNewSize.Content = $"{bc.Size} Bytes";
|
txtNewSize.Content = $"{bc.Size} Bytes";
|
||||||
txtOldSize.Content = $"{bc.PreSize} Bytes";
|
txtOldSize.Content = $"{bc.PreSize} Bytes";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show no changes or only eol changes.
|
||||||
|
/// </summary>
|
||||||
|
private void SetSame() {
|
||||||
|
Dispatcher.Invoke(() => {
|
||||||
|
loading.Visibility = Visibility.Collapsed;
|
||||||
|
noChange.Visibility = Visibility.Visible;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show diff content.
|
/// Show diff content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -105,7 +118,7 @@ namespace SourceGit.UI {
|
||||||
private void SetData(Git.Diff.Result rs) {
|
private void SetData(Git.Diff.Result rs) {
|
||||||
Dispatcher.Invoke(() => {
|
Dispatcher.Invoke(() => {
|
||||||
loading.Visibility = Visibility.Collapsed;
|
loading.Visibility = Visibility.Collapsed;
|
||||||
mask.Visibility = Visibility.Collapsed;
|
textChange.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
minWidth = Math.Max(leftText.ActualWidth, rightText.ActualWidth) - 16;
|
minWidth = Math.Max(leftText.ActualWidth, rightText.ActualWidth) - 16;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue