From fa65a4df95fed5382351530ca50937dfa7eabe7d Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Wed, 7 Feb 2018 11:37:19 +0300 Subject: [PATCH] IDEA-185869 minimized file folded comment issue --- .../intellij/codeInsight/hint/EditorFragmentComponent.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java b/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java index 51b7b59fef2c..2a2f380b843e 100644 --- a/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java +++ b/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.hint; import com.intellij.openapi.application.ApplicationManager; @@ -63,7 +61,7 @@ public class EditorFragmentComponent extends JPanel { } try { Document doc = editor.getDocument(); - int endOffset = endLine < doc.getLineCount() ? doc.getLineEndOffset(endLine) : doc.getTextLength(); + int endOffset = endLine < doc.getLineCount() ? doc.getLineEndOffset(Math.max(0, endLine - 1)) : doc.getTextLength(); int widthAdjustment = newRendering ? EditorUtil.getSpaceWidth(Font.PLAIN, editor) : 0; textImageWidth = Math.min( editor.getMaxWidthInRange(doc.getLineStartOffset(startLine), endOffset) + widthAdjustment,