default @Nullable @NlsSafe String getSelectedText(boolean allCarets) {
    if (allCarets && getEditor().getCaretModel().supportsMultipleCarets()) {
      final StringBuilder buf = new StringBuilder();
      String separator = "";
      for (Caret caret : getEditor().getCaretModel().getAllCarets()) {
        buf.append(separator);
        String caretSelectedText = caret.getSelectedText();
        if (caretSelectedText != null) {
          buf.append(caretSelectedText);
        }
        separator = "\n";
      }
      return buf.toString();
    }
    else {
      return getEditor().getCaretModel().getCurrentCaret().getSelectedText();
    }
  }
default @Nullable @NlsSafe String getSelectedText(boolean allCarets)