Search in sources :

Example 1 with InnerRange

use of com.intellij.openapi.vcs.ex.Range.InnerRange in project intellij-community by JetBrains.

the class VcsPreviewPanel method createModifiedRange.

@NotNull
private static Range createModifiedRange(int currentLine, byte... inner) {
    List<InnerRange> innerRanges = new ArrayList<>();
    int currentInnerLine = currentLine;
    for (byte type : inner) {
        switch(type) {
            case Range.EQUAL:
            case Range.INSERTED:
            case Range.MODIFIED:
                innerRanges.add(new InnerRange(currentInnerLine, currentInnerLine + 1, type));
                currentInnerLine++;
                break;
            case Range.DELETED:
                innerRanges.add(new InnerRange(currentInnerLine, currentInnerLine, type));
                break;
        }
    }
    return new Range(currentLine, currentInnerLine, 0, 1, innerRanges);
}
Also used : ArrayList(java.util.ArrayList) Range(com.intellij.openapi.vcs.ex.Range) TextRange(com.intellij.openapi.util.TextRange) InnerRange(com.intellij.openapi.vcs.ex.Range.InnerRange) InnerRange(com.intellij.openapi.vcs.ex.Range.InnerRange) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

TextRange (com.intellij.openapi.util.TextRange)1 Range (com.intellij.openapi.vcs.ex.Range)1 InnerRange (com.intellij.openapi.vcs.ex.Range.InnerRange)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1