From 7b29634fb8d06da0368c481faa05eb9b9813a2b7 Mon Sep 17 00:00:00 2001 From: "Denis.Zhdanov" Date: Tue, 7 Feb 2012 15:32:57 +0400 Subject: [PATCH] Correct editor size calculation in situation with the single long soft wrapped line --- .../src/com/intellij/openapi/editor/impl/EditorImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index f286def57c1f..90af164413ba 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -6090,6 +6090,11 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi Rectangle visibleArea = getScrollingModel().getVisibleArea(); startToUse = yPositionToLogicalLine(visibleArea.getLocation().y); endToUse = Math.min(endToUse, yPositionToLogicalLine(visibleArea.y + visibleArea.height)); + if (endToUse <= startToUse) { + // There is a possible case that there is the only soft-wrapped line, i.e. end == start. We still want to update the + // size container's width then. + endToUse = Math.min(myLineWidths.size(), startToUse + 1); + } } int maxWidth = 0; for (int i = startToUse; i < endToUse; i++) {