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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleBorder color scale; matchesTextMergeViewer'snormalcolor.static final doubleFill band color scale. -
Method Summary
Modifier and TypeMethodDescriptionstatic RGBborderColor(RGB diffColor, RGB background) Border color of an addition/deletion hunk; darker than the fill band.static intclampDetailedDiffLength(int start, int length, int trimmedEnd) Clampslengthso thatstart + lengthdoes not exceedtrimmedEnd.static intcountLines(String str) Returns the number of lines of the given string, counting a trailing line delimiter as starting a new (empty) line.static intcountLines(String str, int end) Returns the number of lines of the firstendcharacters of the given string, likecountLines(String)on that prefix.static RGBinterpolate(RGB fg, RGB bg, double scale) Linearly interpolates betweenfgandbg: scale 0 returnsfg, scale 1 returnsbg.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.
-
Field Details
-
BORDER_SCALE
public static final double BORDER_SCALEBorder color scale; matchesTextMergeViewer'snormalcolor.- See Also:
-
FILL_SCALE
public static final double FILL_SCALEFill band color scale.- See Also:
-
-
Method Details
-
borderColor
-
interpolate
-
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. -
countLines
Returns the number of lines of the firstendcharacters of the given string, likecountLines(String)on that prefix. -
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. -
clampDetailedDiffLength
public static int clampDetailedDiffLength(int start, int length, int trimmedEnd) Clampslengthso thatstart + lengthdoes not exceedtrimmedEnd. Returns the clamped length, or<= 0when the range falls entirely outside.
-