Class UnifiedDiffText
java.lang.Object
org.eclipse.compare.unifieddiff.internal.UnifiedDiffText
Side-effect free text and style-range helpers used to lay out the unified
diff code minings.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcountLines(String str) Returns the number of lines of the given string, counting a trailing line delimiter as starting a new (empty) line.static intmapOffsetToTabExpanded(String originalStr, int offset, int tabWidth) Maps an offset inoriginalStrto the corresponding offset inreplaceTabWithSpaces(String, int)of the same string.static List<StyleRange> mergeStyleRanges(List<StyleRange> backgrounds, List<StyleRange> foregrounds) Overlays the detailed-diff background ranges onto the syntax coloring ranges.static Stringstatic Stringstatic StringreplaceTabWithSpaces(String str, int tabWidth) Expands every tab intotabWidthspaces.
-
Method Details
-
countLines
Returns the number of lines of the given string, counting a trailing line delimiter as starting a new (empty) line. An empty string is one line. -
removeTrailingNewLines
-
removeLeadingNewLines
-
replaceTabWithSpaces
-
mapOffsetToTabExpanded
Maps an offset inoriginalStrto the corresponding offset inreplaceTabWithSpaces(String, int)of the same string. -
mergeStyleRanges
public static List<StyleRange> mergeStyleRanges(List<StyleRange> backgrounds, List<StyleRange> foregrounds) Overlays the detailed-diff background ranges onto the syntax coloring ranges. Both lists must be sorted by offset and must not overlap within themselves. The returned ranges keep the foreground styling and cover exactly the extent offoregrounds.
-