File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -1032,18 +1032,32 @@ private void CopyWithoutIndicators()
1032
1032
line . Type == Models . TextDiffLineType . None )
1033
1033
continue ;
1034
1034
1035
+ // The first selected line (partial selection)
1035
1036
if ( i == startIdx && startPosition . Column > 1 )
1036
1037
{
1037
1038
builder . AppendLine ( line . Content . Substring ( startPosition . Column - 1 ) ) ;
1038
1039
continue ;
1039
1040
}
1040
1041
1041
- if ( i == endIdx && endPosition . Column < line . Content . Length )
1042
+ // The selection range is larger than original source.
1043
+ if ( i == lines . Count - 1 && i < endIdx )
1042
1044
{
1043
- builder . AppendLine ( line . Content . Substring ( 0 , endPosition . Column - 1 ) ) ;
1044
- continue ;
1045
+ builder . Append ( line . Content ) ;
1046
+ break ;
1047
+ }
1048
+
1049
+ // For the last line (selection range is within original source)
1050
+ if ( i == endIdx )
1051
+ {
1052
+ if ( endPosition . Column < line . Content . Length )
1053
+ builder . Append ( line . Content . Substring ( 0 , endPosition . Column - 1 ) ) ;
1054
+ else
1055
+ builder . Append ( line . Content ) ;
1056
+
1057
+ break ;
1045
1058
}
1046
1059
1060
+ // Other lines.
1047
1061
builder . AppendLine ( line . Content ) ;
1048
1062
}
1049
1063
You can’t perform that action at this time.
0 commit comments