boolean (@NotNull Editor editor) { Document document = editor.getDocument(); int caretOffset = editor.getCaretModel().getOffset(); return document.getLineNumber(caretOffset) >= document.getLineCount() - 1; }