@@ -14,7 +14,7 @@ public enum TextDiffLineType
1414 Deleted ,
1515 }
1616
17- public class TextInlineRange ( int p , int n )
17+ public class TextRange ( int p , int n )
1818 {
1919 public int Start { get ; set ; } = p ;
2020 public int End { get ; set ; } = p + n - 1 ;
@@ -26,7 +26,7 @@ public class TextDiffLine
2626 public string Content { get ; set ; } = "" ;
2727 public int OldLineNumber { get ; set ; } = 0 ;
2828 public int NewLineNumber { get ; set ; } = 0 ;
29- public List < TextInlineRange > Highlights { get ; set ; } = new List < TextInlineRange > ( ) ;
29+ public List < TextRange > Highlights { get ; set ; } = new List < TextRange > ( ) ;
3030 public bool NoNewLineEndOfFile { get ; set ; } = false ;
3131
3232 public string OldLine => OldLineNumber == 0 ? string . Empty : OldLineNumber . ToString ( ) ;
@@ -49,11 +49,6 @@ public class TextDiffSelection
4949 public bool HasChanges { get ; set ; } = false ;
5050 public int IgnoredAdds { get ; set ; } = 0 ;
5151 public int IgnoredDeletes { get ; set ; } = 0 ;
52-
53- public bool IsInRange ( int idx )
54- {
55- return idx >= StartLine - 1 && idx < EndLine ;
56- }
5752 }
5853
5954 public partial class TextDiff
@@ -129,7 +124,11 @@ public void GenerateNewPatchFromSelection(Change change, string fileBlobGuid, Te
129124 var line = Lines [ i ] ;
130125 if ( line . Type != TextDiffLineType . Added )
131126 continue ;
132- writer . WriteLine ( $ "{ ( selection . IsInRange ( i ) ? "+" : " " ) } { line . Content } ") ;
127+
128+ if ( i >= selection . StartLine - 1 && i < selection . EndLine )
129+ writer . WriteLine ( $ "+{ line . Content } ") ;
130+ else
131+ writer . WriteLine ( $ " { line . Content } ") ;
133132 }
134133 }
135134 else
0 commit comments