void (@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { if (EditorUtil.isPasswordEditor(editor)) { int selectionStartOffset = caret.getLeadSelectionOffset(); caret.moveToOffset(myNext ? editor.getDocument().getTextLength() : 0); if (myWithSelection) caret.setSelection(selectionStartOffset, caret.getOffset()); } else { VisualPosition currentPosition = caret.getVisualPosition(); if (caret.isAtBidiRunBoundary() && (myNext ^ currentPosition.leansRight)) { int selectionStartOffset = caret.getLeadSelectionOffset(); VisualPosition selectionStartPosition = caret.getLeadSelectionPosition(); caret.moveToVisualPosition(currentPosition.leanRight(!currentPosition.leansRight)); if (myWithSelection) { caret.setSelection(selectionStartPosition, selectionStartOffset, caret.getVisualPosition(), caret.getOffset()); } } else { if (myNext ^ caret.isAtRtlLocation()) { EditorActionUtil.moveCaretToNextWord(editor, myWithSelection, myInDifferentHumpsMode ^ editor.getSettings().isCamelWords()); } else { EditorActionUtil.moveCaretToPreviousWord(editor, myWithSelection, myInDifferentHumpsMode ^ editor.getSettings().isCamelWords()); } } } }