private @NotNull List<DeletedIndentInfo> findAllDeletions(@NotNull CharSequence buffer, int startOffset, int endOffset) {
    List<DeletedIndentInfo> result = new ArrayList<>();

    int offset = startOffset;
    while (offset < endOffset) {
      final int newline = StringUtil.indexOf(buffer, '\n', offset, endOffset);
      if (newline < 0) {
        break;
      }
      int charsToDelete = 0;

      char c;
      while (charsToDelete < myIndent
          && newline + charsToDelete + 1 < endOffset
          && (c = buffer.charAt(newline + charsToDelete + 1)) != '\n'
          && Character.isWhitespace(c)) {
        charsToDelete++;
      }

      if (charsToDelete > 0) {
        result.add(new DeletedIndentInfo(newline + 1, charsToDelete));
      }
      offset = newline + charsToDelete + 1;
    }

    return result;
  }
private @NotNull List<DeletedIndentInfo> findAllDeletions(@NotNull CharSequence buffer, int startOffset, int endOffset)