Documentation
¶
Overview ¶
Package linediff splits texts into lines and finds a shortest line edit script between two of them. It imports only the standard library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Op ¶
Op is one line of an edit script: Op is ' ' for a kept line, '-' for a line removed from a, '+' for a line added from b.
func Diff ¶
Diff is a shortest edit script from a to b, by Myers' O(ND) algorithm in linear space. The lines both start and end with are kept, and the ones between are compared while their count times the lines that change stays at most 1<<30; past that they are Replace. In each run of changes the removed lines come before the added ones, as git prints them.
Click to show internal directories.
Click to hide internal directories.