@@ -421,7 +421,7 @@ func (dmp *DiffMatchPatch) DiffBisect(text1, text2 string, deadline time.Time) [
421
421
// diffBisect finds the 'middle snake' of a diff, splits the problem in two
422
422
// and returns the recursively constructed diff.
423
423
// See Myers's 1986 paper: An O(ND) Difference Algorithm and Its Variations.
424
- func (dmp * DiffMatchPatch ) diffBisect (text1 , text2 []rune , deadline time.Time ) []Diff {
424
+ func (dmp * DiffMatchPatch ) diffBisect (runes1 , runes2 []rune , deadline time.Time ) []Diff {
425
425
// Cache the text lengths to prevent multiple calls.
426
426
runes1_len , runes2_len := len (runes1 ), len (runes2 )
427
427
@@ -466,8 +466,8 @@ func (dmp *DiffMatchPatch) diffBisect(text1, text2 []rune, deadline time.Time) [
466
466
}
467
467
468
468
y1 := x1 - k1
469
- for x1 < text1_len && y1 < text2_len {
470
- if text1 [x1 ] != text2 [y1 ] {
469
+ for x1 < runes1_len && y1 < runes2_len {
470
+ if runes1 [x1 ] != runes2 [y1 ] {
471
471
break
472
472
}
473
473
x1 ++
@@ -502,8 +502,8 @@ func (dmp *DiffMatchPatch) diffBisect(text1, text2 []rune, deadline time.Time) [
502
502
x2 = v2 [k2_offset - 1 ] + 1
503
503
}
504
504
var y2 = x2 - k2
505
- for x2 < text1_len && y2 < text2_len {
506
- if text1 [ text1_len - x2 - 1 ] != text2 [ text2_len - y2 - 1 ] {
505
+ for x2 < runes1_len && y2 < runes2_len {
506
+ if runes1 [ runes1_len - x2 - 1 ] != runes2 [ runes2_len - y2 - 1 ] {
507
507
break
508
508
}
509
509
x2 ++
@@ -534,21 +534,21 @@ func (dmp *DiffMatchPatch) diffBisect(text1, text2 []rune, deadline time.Time) [
534
534
// Diff took too long and hit the deadline or
535
535
// number of diffs equals number of characters, no commonality at all.
536
536
return []Diff {
537
- Diff {DiffDelete , string (text1 )},
538
- Diff {DiffInsert , string (text2 )},
537
+ Diff {DiffDelete , string (runes1 )},
538
+ Diff {DiffInsert , string (runes2 )},
539
539
}
540
540
}
541
541
542
- func (dmp * DiffMatchPatch ) diffBisectSplit_ (text1 , text2 []rune , x , y int ,
542
+ func (dmp * DiffMatchPatch ) diffBisectSplit_ (runes1 , runes2 []rune , x , y int ,
543
543
deadline time.Time ) []Diff {
544
544
runes1a := runes1 [:x ]
545
545
runes2a := runes2 [:y ]
546
546
runes1b := runes1 [x :]
547
547
runes2b := runes2 [y :]
548
548
549
549
// Compute both diffs serially.
550
- diffs := dmp .diffMainRunes (text1a , text2a , false , deadline )
551
- diffsb := dmp .diffMainRunes (text1b , text2b , false , deadline )
550
+ diffs := dmp .diffMainRunes (runes1a , runes2a , false , deadline )
551
+ diffsb := dmp .diffMainRunes (runes1b , runes2b , false , deadline )
552
552
553
553
return append (diffs , diffsb ... )
554
554
}
0 commit comments