diff --git a/SourceGit/Git/Diff.cs b/SourceGit/Git/Diff.cs index d303aa48..7ce0190c 100644 --- a/SourceGit/Git/Diff.cs +++ b/SourceGit/Git/Diff.cs @@ -223,15 +223,7 @@ namespace SourceGit.Git { rs.Add(current); rs.Fit(); - if (rs.IsBinary) { - 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); - } - + if (rs.IsBinary) rs.Blocks.Clear(); return rs; } diff --git a/SourceGit/UI/About.xaml b/SourceGit/UI/About.xaml index ba517857..a4264255 100644 --- a/SourceGit/UI/About.xaml +++ b/SourceGit/UI/About.xaml @@ -10,7 +10,7 @@ - + diff --git a/SourceGit/UI/DiffViewer.xaml b/SourceGit/UI/DiffViewer.xaml index ec73ec6d..ec6981b4 100644 --- a/SourceGit/UI/DiffViewer.xaml +++ b/SourceGit/UI/DiffViewer.xaml @@ -8,7 +8,7 @@ - + @@ -24,7 +24,9 @@ - + + + @@ -128,7 +130,7 @@ - + + + + + + + - - - diff --git a/SourceGit/UI/DiffViewer.xaml.cs b/SourceGit/UI/DiffViewer.xaml.cs index c29b936c..a63ab5f8 100644 --- a/SourceGit/UI/DiffViewer.xaml.cs +++ b/SourceGit/UI/DiffViewer.xaml.cs @@ -38,7 +38,6 @@ namespace SourceGit.UI { /// public void Reset() { mask.Visibility = Visibility.Visible; - sizer.Visibility = Visibility.Collapsed; } /// @@ -50,7 +49,10 @@ namespace SourceGit.UI { SetTitle(opts.Path, opts.OrgPath); 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(() => { var args = $"{opts.ExtraArgs} "; @@ -62,9 +64,11 @@ namespace SourceGit.UI { var rs = Git.Diff.Run(repo, args); if (rs.IsBinary) { SetSizeChangeData(Git.Diff.GetSizeChange(repo, opts.RevisionRange, opts.Path, opts.OrgPath)); - } else { + } else if (rs.Blocks.Count > 0) { SetData(rs); - } + } else { + SetSame(); + } }); } @@ -91,13 +95,22 @@ namespace SourceGit.UI { private void SetSizeChangeData(Git.Diff.BinaryChange bc) { Dispatcher.Invoke(() => { loading.Visibility = Visibility.Collapsed; - mask.Visibility = Visibility.Collapsed; - sizer.Visibility = Visibility.Visible; + sizeChange.Visibility = Visibility.Visible; txtNewSize.Content = $"{bc.Size} Bytes"; txtOldSize.Content = $"{bc.PreSize} Bytes"; }); } + /// + /// Show no changes or only eol changes. + /// + private void SetSame() { + Dispatcher.Invoke(() => { + loading.Visibility = Visibility.Collapsed; + noChange.Visibility = Visibility.Visible; + }); + } + /// /// Show diff content. /// @@ -105,7 +118,7 @@ namespace SourceGit.UI { private void SetData(Git.Diff.Result rs) { Dispatcher.Invoke(() => { loading.Visibility = Visibility.Collapsed; - mask.Visibility = Visibility.Collapsed; + textChange.Visibility = Visibility.Visible; minWidth = Math.Max(leftText.ActualWidth, rightText.ActualWidth) - 16;