From e64026d44c6034c63b894bf74380e18761348da7 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 18 Jul 2024 11:26:47 +0800 Subject: [PATCH] fix: `MakeSelection` should not use `UseSideBySideDiff` directly --- src/Views/TextDiffView.axaml.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 0b09e3a4..0b7a6071 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -1162,7 +1162,7 @@ namespace SourceGit.Views if (UseSideBySideDiff) (startLine, endLine) = GetUnifiedRange(diff, startLine, endLine, isOldSide); - var selection = MakeSelection(diff, startLine, endLine, isOldSide); + var selection = MakeSelection(diff, startLine, endLine, !UseSideBySideDiff, isOldSide); if (!selection.HasChanges) return; @@ -1429,7 +1429,7 @@ namespace SourceGit.Views if (change == null) return; - var selection = MakeSelection(diff, chunk.StartIdx + 1, chunk.EndIdx + 1, false); + var selection = MakeSelection(diff, chunk.StartIdx + 1, chunk.EndIdx + 1, true, false); if (!selection.HasChanges) return; @@ -1487,7 +1487,7 @@ namespace SourceGit.Views if (change == null) return; - var selection = MakeSelection(diff, chunk.StartIdx + 1, chunk.EndIdx + 1, false); + var selection = MakeSelection(diff, chunk.StartIdx + 1, chunk.EndIdx + 1, true, false); if (!selection.HasChanges) return; @@ -1543,7 +1543,7 @@ namespace SourceGit.Views if (change == null) return; - var selection = MakeSelection(diff, chunk.StartIdx + 1, chunk.EndIdx + 1, false); + var selection = MakeSelection(diff, chunk.StartIdx + 1, chunk.EndIdx + 1, true, false); if (!selection.HasChanges) return; @@ -1632,7 +1632,7 @@ namespace SourceGit.Views return (startLine, endLine); } - private Models.TextDiffSelection MakeSelection(Models.TextDiff diff, int startLine, int endLine, bool isOldSide) + private Models.TextDiffSelection MakeSelection(Models.TextDiff diff, int startLine, int endLine, bool combined, bool isOldSide) { var rs = new Models.TextDiffSelection(); rs.StartLine = startLine; @@ -1658,7 +1658,7 @@ namespace SourceGit.Views var line = diff.Lines[i]; if (line.Type == Models.TextDiffLineType.Added) { - if (!UseSideBySideDiff) + if (combined) { rs.HasChanges = true; break; @@ -1674,7 +1674,7 @@ namespace SourceGit.Views } else if (line.Type == Models.TextDiffLineType.Deleted) { - if (!UseSideBySideDiff) + if (combined) { rs.HasChanges = true; break;