void (@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { VisualPosition currentPosition = caret.getVisualPosition(); if (caret.isAtBidiRunBoundary() && (myMoveRight ^ currentPosition.leansRight)) { int selectionStartToUse = caret.getLeadSelectionOffset(); VisualPosition selectionStartPositionToUse = caret.getLeadSelectionPosition(); caret.moveToVisualPosition(currentPosition.leanRight(!currentPosition.leansRight)); caret.setSelection(selectionStartPositionToUse, selectionStartToUse, caret.getVisualPosition(), caret.getOffset()); } else { editor.getCaretModel().moveCaretRelatively(myMoveRight ? 1 : -1, 0, true, editor.isColumnMode(), caret == editor.getCaretModel().getPrimaryCaret()); } }