mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
fix: the last selected line is missing while trying to copy multiple lines in text diff view (#1044)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
598bba5210
commit
35ee4a47db
1 changed files with 4 additions and 4 deletions
|
@ -1007,8 +1007,8 @@ namespace SourceGit.Views
|
|||
if (startPosition.Location > endPosition.Location)
|
||||
(startPosition, endPosition) = (endPosition, startPosition);
|
||||
|
||||
var startIdx = Math.Min(startPosition.Line - 1, lines.Count - 1);
|
||||
var endIdx = Math.Min(endPosition.Line - 1, lines.Count - 1);
|
||||
var startIdx = startPosition.Line - 1;
|
||||
var endIdx = endPosition.Line - 1;
|
||||
|
||||
if (startIdx == endIdx)
|
||||
{
|
||||
|
@ -1025,7 +1025,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
|
||||
var builder = new StringBuilder();
|
||||
for (var i = startIdx; i <= endIdx; i++)
|
||||
for (var i = startIdx; i <= endIdx && i <= lines.Count - 1; i++)
|
||||
{
|
||||
var line = lines[i];
|
||||
if (line.Type == Models.TextDiffLineType.Indicator ||
|
||||
|
@ -1040,7 +1040,7 @@ namespace SourceGit.Views
|
|||
|
||||
if (i == endIdx && endPosition.Column < line.Content.Length)
|
||||
{
|
||||
builder.AppendLine(line.Content.Substring(0, endPosition.Column));
|
||||
builder.AppendLine(line.Content.Substring(0, endPosition.Column - 1));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue