MCPcopy Create free account
hub / github.com/sergi/go-diff / DiffMainRunes

Method DiffMainRunes

diffmatchpatch/diff.go:92–98  ·  view source on GitHub ↗

DiffMainRunes finds the differences between two rune sequences. The checklines flag is a speedup: if false, don't run a line-level diff first to identify the changed areas; if true, run a faster, slightly less optimal diff. If an invalid UTF-8 sequence is encountered, it will be replaced by the Unic

(text1, text2 []rune, checklines bool)

Source from the content-addressed store, hash-verified

90// The checklines flag is a speedup: if false, don't run a line-level diff first to identify the changed areas; if true, run a faster, slightly less optimal diff.
91// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
92func (dmp *DiffMatchPatch) DiffMainRunes(text1, text2 []rune, checklines bool) []Diff {
93 var deadline time.Time
94 if dmp.DiffTimeout > 0 {
95 deadline = time.Now().Add(dmp.DiffTimeout)
96 }
97 return dmp.diffMainRunes(text1, text2, checklines, deadline)
98}
99
100func (dmp *DiffMatchPatch) diffMainRunes(text1, text2 []rune, checklines bool, deadline time.Time) []Diff {
101 if runesEqual(text1, text2) {

Callers 3

DiffMainMethod · 0.95

Calls 1

diffMainRunesMethod · 0.95