mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-22 10:55:00 +00:00
fix: Copy in TextDiffView may lost the last line
This commit is contained in:
parent
9dffd55c2b
commit
786f4d7d6e
1 changed files with 15 additions and 6 deletions
|
@ -1034,16 +1034,25 @@ namespace SourceGit.Views
|
|||
|
||||
if (i == startIdx && startPosition.Column > 1)
|
||||
{
|
||||
builder.AppendLine(line.Content.Substring(startPosition.Column - 1));
|
||||
var content = line.Content.Substring(startPosition.Column - 1);
|
||||
if (i == endIdx && endPosition.Column < line.Content.Length + 1)
|
||||
builder.Append(content.Substring(0,
|
||||
Math.Min(content.Length, endPosition.Column - startPosition.Column)));
|
||||
else
|
||||
builder.AppendLine(content);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i == endIdx && endPosition.Column < line.Content.Length)
|
||||
if (i == endIdx)
|
||||
{
|
||||
builder.AppendLine(line.Content.Substring(0, endPosition.Column));
|
||||
continue;
|
||||
// Handle the last line specially
|
||||
if (endPosition.Column > 1)
|
||||
builder.Append(line.Content.Substring(0,
|
||||
Math.Min(line.Content.Length, endPosition.Column - 1)));
|
||||
else
|
||||
builder.Append(line.Content);
|
||||
}
|
||||
|
||||
else
|
||||
builder.AppendLine(line.Content);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue