void (@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { if (!caret.hasSelection()) { return; } final int start = caret.getSelectionStart(); final int end = caret.getSelectionEnd(); boolean moveToEnd = caret.getOffset() == start; if (editor instanceof EditorEx editorEx) { if (editorEx.isStickySelection()) { editorEx.setStickySelection(false); editorEx.setStickySelection(true); } } if (moveToEnd) { caret.moveToOffset(end); } else { caret.moveToOffset(start); } }