void () { if (myEditor.isStickySelection()) { // Most of our 'change caret position' actions (like move caret to word start/end etc.) remove active selection. // However, we don't want to do that for 'sticky selection'. return; } myCaretModel.doWithCaretMerging(() -> { ThreadingAssertions.assertEventDispatchThread(); myUnknownDirection = false; RangeMarker marker = mySelectionMarker; if (marker != null && marker.isValid()) { int startOffset = marker.getStartOffset(); int endOffset = marker.getEndOffset(); int caretOffset = getOffset(); mySelectionMarker = null; marker.dispose(); myEditor.getSelectionModel().fireSelectionChanged(new SelectionEvent(myEditor, startOffset, endOffset, caretOffset, caretOffset)); } }); }