Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ThemeDefault = func(t Type) gop.Style { switch t { case AddSymbol, AddWords: return gop.BgGreen case DelSymbol, DelWords: return gop.BgRed case ChunkStart: return gop.BgMagenta } return gop.None }
ThemeDefault colors for Sprint
ThemeNone colors for Sprint
Functions ¶
func TokenizeLine ¶
TokenizeLine two different lines
Types ¶
type Comparable ¶
type Comparable interface {
// Hash for comparison
Hash() []byte
}
Comparable interface
func LCS ¶
func LCS(x, y []Comparable) []Comparable
LCS extends the standard lcs algorithm with dynamic programming and recursive common-lines reduction. The base algorithm we use is here: https://en.wikipedia.org/wiki/Longest_common_subsequence_problem#LCS_function_defined. TODO: implement Patience Diff http://alfedenzo.livejournal.com/170301.html
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line of a string for fast comparison.
type Token ¶
Token presents a symbol in diff layout
func SpreadTokenLines ¶ added in v0.23.2
SpreadTokenLines to tokens
func Tokenize ¶ added in v0.24.0
Tokenize x and y into diff tokens with diff words and narrow chunks.
func TokenizeText ¶
TokenizeText text block a and b into diff tokens.
type TokenLine ¶ added in v0.23.2
TokenLine of tokens
func ParseTokenLines ¶ added in v0.23.2
ParseTokenLines of tokens
type Type ¶
type Type int
Type of token
const ( // Newline type Newline Type = iota // Space type Space // ChunkStart type ChunkStart // ChunkEnd type ChunkEnd // SameSymbol type SameSymbol // SameLine type SameLine // AddSymbol type AddSymbol // AddLine type AddLine // DelSymbol typ DelSymbol // DelLine type DelLine // SameWords type SameWords // AddWords type AddWords // DelWords type DelWords // EmptyLine type EmptyLine )