Package org.jline.utils
Class DiffHelper
- java.lang.Object
-
- org.jline.utils.DiffHelper
-
public class DiffHelper extends java.lang.Object
Class containing the diff method. This diff is ANSI aware and will correctly handle text attributes so that any text in a Diff object is a valid ansi string.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DiffHelper.Diff
Class representing one diff operation.static class
DiffHelper.Operation
The data structure representing a diff is a Linked 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."
-
Constructor Summary
Constructors Constructor Description DiffHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<DiffHelper.Diff>
diff(AttributedString text1, AttributedString text2)
Compute a list of difference between two lines.
-
-
-
Method Detail
-
diff
public static java.util.List<DiffHelper.Diff> diff(AttributedString text1, AttributedString text2)
Compute a list of difference between two lines. The result will contain at most 4 Diff objects, as the method aims to return the common prefix, inserted text, deleted text and common suffix. The computation is done on characters and their attributes expressed as ansi sequences.- Parameters:
text1
- the old linetext2
- the new line- Returns:
- a list of Diff
-
-