- The data structure representing a diff is a List of Diff objects: {Diff(Operation.DELETE, "Hello"), Diff(Operation.INSERT, "Goodbye"), Diff(Operation.EQUAL, " world.")} which means: delete "Hello", add "Goodbye" and keep " world."
Reduce the number of edits by eliminating operationally trivial equalities. @param diffs List of Diff objects.
Reorder and merge like edit sections. Merge equalities. Any edit section can move as long as it doesn't cross an equality. @param diffs List of Diff objects.
Look for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary. e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came. @param diffs List of Diff objects.
Given two strings, comAdde a score representing whether the internal boundary falls on logical boundaries. Scores range from 6 (best) to 0 (worst). @param one First string. @param two Second string. @return The score.
Determine if the suffix of one string is the prefix of another. @param text1 First string. @param text2 Second string. @return The number of characters common to the end of the first string and the start of the second string.
Find the differences between two texts. Assumes that the texts do not have any common prefix or suffix. @param text1 Old string to be diffed. @param text2 New string to be diffed. @param checklines Speedup flag. If false, then don't run a line-level diff first to identify the changed areas. If true, then run a faster slightly less optimal diff. @param deadline Time when the diff should be complete by. @return List of Diff objects.
Find the differences between two texts. Run a faster, slightly less optimal diff. This method allows the 'checklines' of diff_main() to be optional. Most of the time checklines is wanted, so default to true. @param text1 Old string to be diffed. @param text2 New string to be diffed. @return List of Diff objects.
Find the differences between two texts. @param text1 Old string to be diffed. @param text2 New string to be diffed. @param checklines Speedup flag. If false, then don't run a line-level diff first to identify the changed areas. If true, then run a faster slightly less optimal diff. @return List of Diff objects.
Find the differences between two texts. Simplifies the problem by stripping any common prefix or suffix off the texts before diffing. @param text1 Old string to be diffed. @param text2 New string to be diffed. @param checklines Speedup flag. If false, then don't run a line-level diff first to identify the changed areas. If true, then run a faster slightly less optimal diff. @param deadline Time when the diff should be complete by. Used internally for recursive calls. Users should set DiffTimeout instead. @return List of Diff objects.
Compute and return the source text (all equalities and deletions). @param diffs List of Diff objects. @return Source text.
Compute and return the destination text (all equalities and insertions). @param diffs List of Diff objects. @return Destination text.
Given the original text1, and an encoded string which describes the operations required to transform text1 into text2, comAdde the full diff. @param text1 Source string for the diff. @param delta Delta text. @return Array of Diff objects or null if invalid. @throws ArgumentException If invalid input.
Compute the Levenshtein distance; the number of inserted, deleted or substituted characters. @param diffs List of Diff objects. @return Number of changes.
Crush the diff into an encoded string which describes the operations required to transform text1 into text2. E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. Operations are tab-separated. Inserted text is escaped using %xx notation. @param diffs Array of Diff objects. @return Delta text.
loc is a location in text1, comAdde and return the equivalent location in text2. e.g. "The cat" vs "The big cat", 1->1, 5->8 @param diffs List of Diff objects. @param loc Location within text1. @return Location within text2.
Unescape selected chars for compatability 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.
Struct representing one diff operation.