fix: Prevent extra newlines when copy lines

This commit is contained in:
Gadfly 2025-03-04 15:38:29 +08:00
parent 5301a368e0
commit dbceb5b6c0
No known key found for this signature in database

View file

@ -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());