private static @NotNull String getLeadingSpacesStartingFrom(String text, int startIdx) {
    int firstNotSpace = text.length();
    for (int idx = startIdx; idx < text.length(); idx++) {
      char next = text.charAt(idx);
      if (!Character.isWhitespace(next)) {
        firstNotSpace = idx;
        break;
      }
    }
    return text.substring(startIdx, firstNotSpace);
  }
private static @NotNull String getLeadingSpacesStartingFrom(String text, int startIdx)