@NotNull
  private static TextRange calculateChangeHighlightRange(@NotNull CharSequence text, int startOffset, int endOffset) {
    if (startOffset == endOffset) {
      while (startOffset < text.length() && text.charAt(startOffset) == ' ') {
        startOffset++;
      }
      return new TextRange(startOffset, startOffset);
    }

    int originalStartOffset = startOffset;
    int originalEndOffset = endOffset;

    while (endOffset < text.length() &&
           rangesEqual(text, originalStartOffset, originalEndOffset, startOffset + 1, endOffset + 1)) {
      startOffset++;
      endOffset++;
    }

    return new TextRange(startOffset, endOffset);
  }
@NotNull
  private static TextRange calculateChangeHighlightRange(@NotNull CharSequence text, int startOffset, int endOffset)