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

Method DiffForLine

texteditor/text/diff.go:25–32  ·  view source on GitHub ↗

DiffForLine returns the diff record applying to given line, and its index in slice

(line int)

Source from the content-addressed store, hash-verified

23// DiffForLine returns the diff record applying to given line, and its index in slice
24
25func (di Diffs) DiffForLine(line int) (int, difflib.OpCode) {
26 for i, df := range di {
27 if line >= df.I1 && (line < df.I2 || line < df.J2) {
28 return i, df
29 }
30 }
31 return -1, difflib.OpCode{}
32}
33
34func DiffOpReverse(op difflib.OpCode) difflib.OpCode {
35 op.J1, op.I1 = op.I1, op.J1 // swap

Callers 3

nextDiffMethod · 0.80
prevDiffMethod · 0.80
applyDiffMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected