@Override
    @RequiresEdt
    public void caretRemoved(@NotNull CaretEvent event) {
      // Removing a caret may cause a switching of the primary caret

      if (isInsideBulkUpdate()) {
        return;
      }

      final var currentPrimaryCaret = editor.getCaretModel().getPrimaryCaret();

      if (myLastKnownPrimaryCaret.refersTo(currentPrimaryCaret)) {
        // The removal of a caret didn't cause a switching of the primary caret, so its position isn't supposed to have changed
        return;
      }

      primaryCaretPositionPossiblyChanged(currentPrimaryCaret);
    }
@Override
    @RequiresEdt
    public void caretRemoved(@NotNull CaretEvent event)