mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
fix: there's an extra line-ending while copy multiple lines from text diff view (#1049)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
b75676a7f8
commit
96538b9a62
1 changed files with 17 additions and 3 deletions
|
@ -1032,18 +1032,32 @@ namespace SourceGit.Views
|
|||
line.Type == Models.TextDiffLineType.None)
|
||||
continue;
|
||||
|
||||
// The first selected line (partial selection)
|
||||
if (i == startIdx && startPosition.Column > 1)
|
||||
{
|
||||
builder.AppendLine(line.Content.Substring(startPosition.Column - 1));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i == endIdx && endPosition.Column < line.Content.Length)
|
||||
// The selection range is larger than original source.
|
||||
if (i == lines.Count - 1 && i < endIdx)
|
||||
{
|
||||
builder.AppendLine(line.Content.Substring(0, endPosition.Column - 1));
|
||||
continue;
|
||||
builder.Append(line.Content);
|
||||
break;
|
||||
}
|
||||
|
||||
// For the last line (selection range is within original source)
|
||||
if (i == endIdx)
|
||||
{
|
||||
if (endPosition.Column < line.Content.Length)
|
||||
builder.Append(line.Content.Substring(0, endPosition.Column - 1));
|
||||
else
|
||||
builder.Append(line.Content);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Other lines.
|
||||
builder.AppendLine(line.Content);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue