void (@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { Document document = editor.getDocument(); int currentLine = caret.getLogicalPosition().line; int lineCount = document.getLineCount(); if (isLineEmpty(document, currentLine)) { while (++currentLine < lineCount) { if (!isLineEmpty(document, currentLine)) { break; } } } int targetOffset = document.getTextLength(); while (++currentLine < lineCount) { if (isLineEmpty(document, currentLine)) { targetOffset = document.getLineStartOffset(currentLine); break; } } EditorActionUtil.moveCaret(caret, targetOffset, myWithSelection); }