boolean (@NotNull Caret caret) { EditorImpl.assertIsDispatchThread(); if (myCarets.size() <= 1 || !(caret instanceof CaretImpl)) { return false; } synchronized (myCarets) { if (!myCarets.remove(caret)) { return false; } myPrimaryCaret = myCarets.getLast(); } fireCaretRemoved(caret); Disposer.dispose(caret); return true; }