boolean (@NotNull Editor editor) { final Caret currentCaret = editor.getCaretModel().getCurrentCaret(); final int currentCaretLine = currentCaret.getLogicalPosition().line; final Caret firstCaretInLine = editor.getCaretModel().getAllCarets().stream() .filter(it -> it.getLogicalPosition().line == currentCaretLine) .min(Comparator.comparing(Caret::getOffset)) .get(); return currentCaret == firstCaretInLine; }