Versions in this module Expand all Collapse all v0 v0.16.2 Dec 23, 2024 v0.16.1 Dec 20, 2024 v0.16.0 Dec 20, 2024 Changes in this version + const BINARY + const MAX_DIFF_SIZE + const STYLE_DEFAULT + const STYLE_DIFF3 + const STYLE_ZEALOUS_DIFF3 + const SepO + const UTF8 + var ErrNonTextContent = errors.New("non-text content") + func DefaultMerge(ctx context.Context, o, a, b string, labelO, labelA, labelB string) (string, bool, error) + func NewTextReader(r io.Reader) (io.Reader, error) + func NewUnifiedReader(r io.Reader) (io.Reader, error) + func NewUnifiedReaderEx(r io.Reader, textconv bool) (io.Reader, string, error) + func ParseConflictStyle(s string) int + func ReadUnifiedText(r io.Reader, size int64, textconv bool) (content string, charset string, err error) type Algorithm + func AlgorithmFromName(s string) (Algorithm, error) + type MergeOptions struct + A Algorithm + LabelA string + LabelB string + LabelO string + R1 io.Reader + R2 io.Reader + RO io.Reader + Style int + TextA string + TextB string + TextO string + func (opts *MergeOptions) ValidateOptions() error type UnifiedEncoder + func (e *UnifiedEncoder) SetNoRename() *UnifiedEncoder v0.15.1 Dec 16, 2024 v0.15.0 Dec 16, 2024 Changes in this version + const DefaultContextLines + const MaxChainLen + const NEWLINE_CRLF + const NEWLINE_LF + const NEWLINE_RAW + const Sep1 + const Sep2 + const Sep3 + const ZERO_OID + var ErrUnsupportedAlgorithm = errors.New("unsupport algorithm") + func Merge(ctx context.Context, o, a, b string, labelO, labelA, labelB string) (string, bool, error) + type Algorithm int + const Histogram + const Minimal + const Myers + const ONP + const Patience + const Unspecified + func (a Algorithm) String() string + type Change struct + Del int + Ins int + P1 int + P2 int + func HistogramDiff[E comparable](ctx context.Context, L1, L2 []E) ([]Change, error) + func MinimalDiff[E comparable](ctx context.Context, L1 []E, L2 []E) ([]Change, error) + func MyersDiff[E comparable](ctx context.Context, L1 []E, L2 []E) ([]Change, error) + func OnpDiff[E comparable](ctx context.Context, L1, L2 []E) ([]Change, error) + func PatienceDiff[E comparable](ctx context.Context, L1 []E, L2 []E) ([]Change, error) + type Conflict struct + type Dfio struct + E []E + T Operation + func DiffSlices[E comparable](ctx context.Context, S1, S2 []E) ([]Dfio[E], error) + type Diff3MergeResult struct + func Diff3Merge[E comparable](a, o, b []E, excludeFalseConflicts bool) []*Diff3MergeResult[E] + type FastArrayNegativeIndices struct + type FastIntArray struct + func NewFastIntArray() *FastIntArray + type File struct + Hash string + Mode uint32 + Name string + type FileStat struct + Addition int + Deletion int + Hunks int + func Stat(ctx context.Context, opts *Options) (*FileStat, error) + type Hunk struct + FromLine int + Lines []Line + ToLine int + func (h Hunk) Stat() (int, int) + type Lcs struct + type LcsSearch struct + type Line struct + Content string + Kind Operation + type Operation int8 + const Delete + const Equal + const Insert + type Options struct + A Algorithm + From *File + R1 io.Reader + R2 io.Reader + S1 string + S2 string + To *File + type Sink struct + Index map[string]int + Lines []string + NewLine int + func NewSink(newLineMode int) *Sink + func (s *Sink) AsStringDiff(o []Dfio[int]) []StringDiff + func (s *Sink) ScanLines(r io.Reader) ([]int, error) + func (s *Sink) ScanRawLines(r io.Reader) ([]int, error) + func (s *Sink) SplitLines(text string) []int + func (s *Sink) SplitRawLines(text string) []int + func (s *Sink) ToUnified(from, to *File, changes []Change, linesA, linesB []int, contextLines int) *Unified + func (s *Sink) WriteLine(w io.Writer, E ...int) + type SnakePath struct + func NewSnakePath(pre *SnakePath, x, y, length int) *SnakePath + type StringDiff struct + Text string + Type Operation + type Unified struct + From *File + Hunks []*Hunk + IsBinary bool + IsFragments bool + Message string + To *File + func DoUnified(ctx context.Context, opts *Options) (*Unified, error) + func (u Unified) Stat() FileStat + func (u Unified) String() string + type UnifiedEncoder struct + func NewUnifiedEncoder(w io.Writer) *UnifiedEncoder + func (e *UnifiedEncoder) Encode(patches []*Unified) error + func (e *UnifiedEncoder) SetColor(colorConfig color.ColorConfig) *UnifiedEncoder + func (e *UnifiedEncoder) SetDstPrefix(prefix string) *UnifiedEncoder + func (e *UnifiedEncoder) SetSrcPrefix(prefix string) *UnifiedEncoder