boolean addCaret(@NotNull CaretImpl caretToAdd, boolean makePrimary) {
    if (myCarets.size() >= getMaxCaretCount()) {
      return false;
    }
    for (CaretImpl caret : myCarets) {
      if (caretsOverlap(caret, caretToAdd)) {
        return false;
      }
    }
    synchronized (myCarets) {
      if (makePrimary) {
        myCarets.addLast(caretToAdd);
        myPrimaryCaret = caretToAdd;
      }
      else {
        myCarets.addFirst(caretToAdd);
      }
    }
    fireCaretAdded(caretToAdd);
    return true;
  }
boolean addCaret(@NotNull CaretImpl caretToAdd, boolean makePrimary)