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()
10321032 line . Type == Models . TextDiffLineType . None )
10331033 continue ;
10341034
1035+ // The first selected line (partial selection)
10351036 if ( i == startIdx && startPosition . Column > 1 )
10361037 {
10371038 builder . AppendLine ( line . Content . Substring ( startPosition . Column - 1 ) ) ;
10381039 continue ;
10391040 }
10401041
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 )
10421044 {
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 ;
10451058 }
10461059
1060+ // Other lines.
10471061 builder . AppendLine ( line . Content ) ;
10481062 }
10491063
You can’t perform that action at this time.
0 commit comments