CPP-4964 Quick definition for user commands and macros in CMake
authorVasily Pisar <vasily.pisar@jetbrains.com>
Fri, 26 Feb 2016 12:19:13 +0000 (15:19 +0300)
committerVasily Pisar <vasily.pisar@jetbrains.com>
Fri, 26 Feb 2016 12:19:13 +0000 (15:19 +0300)
– fixing a bug when we showed more lines than we should (see https://youtrack.jetbrains.com/issue/CPP-4964#comment=27-1282383)

platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java

index 0a8a4aae9a2acd0d6555fb3378795bd585b6ce33..2d654e125d72e657e0138dd4690007b6edcfc5f9 100644 (file)
@@ -446,7 +446,10 @@ public class ImplementationViewComponent extends JPanel {
     final ImplementationTextSelectioner implementationTextSelectioner =
       LanguageImplementationTextSelectioner.INSTANCE.forLanguage(elt.getLanguage());
     int start = implementationTextSelectioner.getTextStartOffset(elt);
-    final int end = implementationTextSelectioner.getTextEndOffset(elt);
+    int end = implementationTextSelectioner.getTextEndOffset(elt);
+    while (end > start && StringUtil.endsWithLineBreak(doc.getCharsSequence().subSequence(start, end))) {
+      end--;
+    }
 
     final int lineStart = doc.getLineStartOffset(doc.getLineNumber(start));
     final int lineEnd = end < doc.getTextLength() ? doc.getLineEndOffset(doc.getLineNumber(end)) : doc.getTextLength();