@@ -676,7 +676,7 @@ protected void diff_charsToLines(ICollection<Diff> diffs,
676676 * @return The number of characters common to the start of each string.
677677 */
678678 public int diff_commonPrefix ( string text1 , string text2 ) {
679- // Performance analysis: http ://neil.fraser.name/news/2007/10/09/
679+ // Performance analysis: https ://neil.fraser.name/news/2007/10/09/
680680 int n = Math . Min ( text1 . Length , text2 . Length ) ;
681681 for ( int i = 0 ; i < n ; i ++ ) {
682682 if ( text1 [ i ] != text2 [ i ] ) {
@@ -693,7 +693,7 @@ public int diff_commonPrefix(string text1, string text2) {
693693 * @return The number of characters common to the end of each string.
694694 */
695695 public int diff_commonSuffix ( string text1 , string text2 ) {
696- // Performance analysis: http ://neil.fraser.name/news/2007/10/09/
696+ // Performance analysis: https ://neil.fraser.name/news/2007/10/09/
697697 int text1_length = text1 . Length ;
698698 int text2_length = text2 . Length ;
699699 int n = Math . Min ( text1 . Length , text2 . Length ) ;
@@ -734,7 +734,7 @@ protected int diff_commonOverlap(string text1, string text2) {
734734
735735 // Start by looking for a single character match
736736 // and increase length until no match is found.
737- // Performance analysis: http ://neil.fraser.name/news/2010/11/04/
737+ // Performance analysis: https ://neil.fraser.name/news/2010/11/04/
738738 int best = 0 ;
739739 int length = 1 ;
740740 while ( true ) {
@@ -1220,22 +1220,19 @@ public void diff_cleanupMerge(List<Diff> diffs) {
12201220 }
12211221 }
12221222 // Delete the offending records and add the merged ones.
1223- if ( count_delete == 0 ) {
1224- diffs . Splice ( pointer - count_insert ,
1225- count_delete + count_insert ,
1226- new Diff ( Operation . INSERT , text_insert ) ) ;
1227- } else if ( count_insert == 0 ) {
1228- diffs . Splice ( pointer - count_delete ,
1229- count_delete + count_insert ,
1223+ pointer -= count_delete + count_insert ;
1224+ diffs . Splice ( pointer , count_delete + count_insert ) ;
1225+ if ( text_delete . Length != 0 ) {
1226+ diffs . Splice ( pointer , 0 ,
12301227 new Diff ( Operation . DELETE , text_delete ) ) ;
1231- } else {
1232- diffs . Splice ( pointer - count_delete - count_insert ,
1233- count_delete + count_insert ,
1234- new Diff ( Operation . DELETE , text_delete ) ,
1228+ pointer ++ ;
1229+ }
1230+ if ( text_insert . Length != 0 ) {
1231+ diffs . Splice ( pointer , 0 ,
12351232 new Diff ( Operation . INSERT , text_insert ) ) ;
1233+ pointer ++ ;
12361234 }
1237- pointer = pointer - count_delete - count_insert +
1238- ( count_delete != 0 ? 1 : 0 ) + ( count_insert != 0 ? 1 : 0 ) + 1 ;
1235+ pointer ++ ;
12391236 } else if ( pointer != 0
12401237 && diffs [ pointer - 1 ] . operation == Operation . EQUAL ) {
12411238 // Merge this equality with the previous one.
@@ -1860,7 +1857,7 @@ public List<Patch> patch_make(string text1, List<Diff> diffs) {
18601857 patches . Add ( patch ) ;
18611858 patch = new Patch ( ) ;
18621859 // Unlike Unidiff, our patch lists have a rolling context.
1863- // http ://code.google. com/p/ google- diff-match-patch/wiki/Unidiff
1860+ // https ://github. com/google/ diff-match-patch/wiki/Unidiff
18641861 // Update prepatch text & pos to reflect the application of the
18651862 // just completed patch.
18661863 prepatch_text = postpatch_text ;
0 commit comments