Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapOldLineToNew ¶
MapOldLineToNew builds a mapping from old line numbers to new line numbers using the diff entries. For unchanged lines it maps directly. For removed lines it maps to the nearest subsequent new line in the new document. Returns a map[int]int where key=old line, value=new line.
func SplitLines ¶
SplitLines splits content into lines, returning an empty slice for empty input.
Types ¶
type DiffEntry ¶
type DiffEntry struct {
Type string `json:"type"` // "unchanged", "added", or "removed"
OldLine int `json:"old_line,omitempty"` // 1-based line number in old content (0 if added)
NewLine int `json:"new_line,omitempty"` // 1-based line number in new content (0 if removed)
Text string `json:"text"`
}
DiffEntry represents a single line in the diff output.
func ComputeLineDiff ¶
ComputeLineDiff computes a line-level diff between oldContent and newContent using Hirschberg's algorithm (divide-and-conquer LCS in O(n) space). Each line is classified as "unchanged", "added", or "removed".
Click to show internal directories.
Click to hide internal directories.