Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / github.com / sergi / go-diff@v1.1.0 / diffmatchpatch / diffmatchpatch.go
1 // Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
2 // https://github.com/sergi/go-diff
3 // See the included LICENSE file for license details.
4 //
5 // go-diff is a Go implementation of Google's Diff, Match, and Patch library
6 // Original library is Copyright (c) 2006 Google Inc.
7 // http://code.google.com/p/google-diff-match-patch/
8
9 // Package diffmatchpatch offers robust algorithms to perform the operations required for synchronizing plain text.
10 package diffmatchpatch
11
12 import (
13         "time"
14 )
15
16 // DiffMatchPatch holds the configuration for diff-match-patch operations.
17 type DiffMatchPatch struct {
18         // Number of seconds to map a diff before giving up (0 for infinity).
19         DiffTimeout time.Duration
20         // Cost of an empty edit operation in terms of edit characters.
21         DiffEditCost int
22         // How far to search for a match (0 = exact location, 1000+ = broad match). A match this many characters away from the expected location will add 1.0 to the score (0.0 is a perfect match).
23         MatchDistance int
24         // When deleting a large block of text (over ~64 characters), how close do the contents have to be to match the expected contents. (0.0 = perfection, 1.0 = very loose).  Note that MatchThreshold controls how closely the end points of a delete need to match.
25         PatchDeleteThreshold float64
26         // Chunk size for context length.
27         PatchMargin int
28         // The number of bits in an int.
29         MatchMaxBits int
30         // At what point is no match declared (0.0 = perfection, 1.0 = very loose).
31         MatchThreshold float64
32 }
33
34 // New creates a new DiffMatchPatch object with default parameters.
35 func New() *DiffMatchPatch {
36         // Defaults.
37         return &DiffMatchPatch{
38                 DiffTimeout:          time.Second,
39                 DiffEditCost:         4,
40                 MatchThreshold:       0.5,
41                 MatchDistance:        1000,
42                 PatchDeleteThreshold: 0.5,
43                 PatchMargin:          4,
44                 MatchMaxBits:         32,
45         }
46 }