MCPcopy Create free account
hub / github.com/cogentcore/core / diffBuffers

Method diffBuffers

texteditor/text/lines.go:1833–1837  ·  view source on GitHub ↗

Diff diffBuffers computes the diff between this buffer and the other buffer, reporting a sequence of operations that would convert this buffer (a) into the other buffer (b). Each operation is either an 'r' (replace), 'd' (delete), 'i' (insert) or 'e' (equal). Everything is line-based (0, offset).

(ob *Lines)

Source from the content-addressed store, hash-verified

1831// the other buffer (b). Each operation is either an 'r' (replace), 'd'
1832// (delete), 'i' (insert) or 'e' (equal). Everything is line-based (0, offset).
1833func (ls *Lines) diffBuffers(ob *Lines) Diffs {
1834 astr := ls.strings(false)
1835 bstr := ob.strings(false)
1836 return DiffLines(astr, bstr)
1837}
1838
1839// patchFromBuffer patches (edits) using content from other,
1840// according to diff operations (e.g., as generated from DiffBufs).

Callers 1

DiffBuffersMethod · 0.95

Calls 2

stringsMethod · 0.95
DiffLinesFunction · 0.85

Tested by

no test coverage detected