int (@NotNull Editor editor, @NotNull LogicalPosition position) { return ReadAction.compute(() -> { int startOffset = editor.getDocument().getLineStartOffset(position.line); int endOffset = editor.logicalPositionToOffset(position); return editor.getSoftWrapModel().getSoftWrapsForRange(startOffset, endOffset).size(); }); }