// Package diffmatchpatch offers robust algorithms to perform the operations required for synchronizing plain text.
packagediffmatchpatch
import(
"time"
)
// DiffMatchPatch holds the configuration for diff-match-patch operations.
typeDiffMatchPatchstruct{
// Number of seconds to map a diff before giving up (0 for infinity).
DiffTimeouttime.Duration
// Cost of an empty edit operation in terms of edit characters.
DiffEditCostint
// 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).
MatchDistanceint
// 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.
PatchDeleteThresholdfloat64
// Chunk size for context length.
PatchMarginint
// The number of bits in an int.
MatchMaxBitsint
// At what point is no match declared (0.0 = perfection, 1.0 = very loose).
MatchThresholdfloat64
}
// New creates a new DiffMatchPatch object with default parameters.
// Scan for the best match; each iteration allows for one more error. Run a binary search to determine how far from 'loc' we can stray at this error level.
// unescaper unescapes selected chars for compatibility with JavaScript's encodeURI.
// In speed critical applications this could be dropped since the receiving application will certainly decode these fine. Note that this function is case-sensitive. Thus "%3F" would not be unescaped. But this is ok because it is only called with the output of HttpUtility.UrlEncode which returns lowercase hex. Example: "%3f" -> "?", "%24" -> "$", etc.