boolean (@Nullable DocumentEvent event) { if (Boolean.FALSE.equals(myEditor.getUserData(EditorImpl.FORCED_SOFT_WRAPS))) { return false; } Project project = myEditor.getProject(); Document document = myEditor.getDocument(); if (project != null && PostprocessReformattingAspect.getInstance(project).isDocumentLocked(document)) { // Disable checking for files in intermediate states - e.g., for files during refactoring. return false; } int lineWidthLimit = AdvancedSettings.getInt("editor.soft.wrap.force.limit"); int startLine = event == null ? 0 : document.getLineNumber(event.getOffset()); int endLine = event == null ? document.getLineCount() - 1 : document.getLineNumber(event.getOffset() + event.getNewLength()); for (int i = startLine; i <= endLine; i++) { if (document.getLineEndOffset(i) - document.getLineStartOffset(i) > lineWidthLimit) { return true; } } return false; }