Merge branch 'master' into daywalker/cmake_editing
authorVasily Pisar <vasily.pisar@jetbrains.com>
Wed, 27 Apr 2016 12:56:35 +0000 (15:56 +0300)
committerVasily Pisar <vasily.pisar@jetbrains.com>
Wed, 27 Apr 2016 12:56:35 +0000 (15:56 +0300)
platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java

index ee459ab948ff19bfa1e8869036408460cddda564..a9ac6f35938af7b9f8e1c68972b78d923d3e69db 100644 (file)
@@ -447,7 +447,11 @@ 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);
+    CharSequence rawDefinition = doc.getCharsSequence().subSequence(start, end);
+    while (end > start && StringUtil.isLineBreak(rawDefinition.charAt(end - start - 1))) { // removing trailing EOLs from definition
+      end--;
+    }
 
     final int lineStart = doc.getLineStartOffset(doc.getLineNumber(start));
     final int lineEnd = end < doc.getTextLength() ? doc.getLineEndOffset(doc.getLineNumber(end)) : doc.getTextLength();