From 7c3c022cccc1974a9584068613337a4de419eee5 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 20 Mar 2024 20:34:24 +0800 Subject: [PATCH] enhance: use previous state before we get new diff result --- src/SourceGit/ViewModels/DiffContext.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/SourceGit/ViewModels/DiffContext.cs b/src/SourceGit/ViewModels/DiffContext.cs index 5e474ff8..c0654c82 100644 --- a/src/SourceGit/ViewModels/DiffContext.cs +++ b/src/SourceGit/ViewModels/DiffContext.cs @@ -74,7 +74,13 @@ namespace SourceGit.ViewModels { _repo = repo; _option = option; - _content = previous != null ? previous._content : null; + + if (previous != null) + { + _isNoChange = previous._isNoChange; + _isTextDiff = previous._isTextDiff; + _content = previous._content; + } OnPropertyChanged(nameof(FilePath)); OnPropertyChanged(nameof(IsOrgFilePathVisible)); @@ -107,16 +113,21 @@ namespace SourceGit.ViewModels if (latest.IsBinary) { Content = binaryDiff; + IsTextDiff = false; + IsNoChange = false; } else if (latest.IsLFS) { Content = latest.LFSDiff; + IsTextDiff = false; + IsNoChange = false; } else if (latest.TextDiff != null) { latest.TextDiff.File = _option.Path; Content = latest.TextDiff; IsTextDiff = true; + IsNoChange = false; } else {