diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 958e803e..b67d6633 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -1034,17 +1034,20 @@ namespace SourceGit.Views if (i == startIdx && startPosition.Column > 1) { - builder.AppendLine(line.Content.Substring(startPosition.Column - 1)); - continue; + builder.Append(line.Content.Substring(startPosition.Column - 1)); } - - if (i == endIdx && endPosition.Column < line.Content.Length) + else if (i == endIdx && endPosition.Column < line.Content.Length) { - builder.AppendLine(line.Content.Substring(0, endPosition.Column - 1)); - continue; + if (builder.Length > 0) + builder.AppendLine(); + builder.Append(line.Content.Substring(0, endPosition.Column - 1)); + } + else + { + if (builder.Length > 0) + builder.AppendLine(); + builder.Append(line.Content); } - - builder.AppendLine(line.Content); } App.CopyText(builder.ToString());