diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CompletionAutoPopupHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CompletionAutoPopupHandler.java index 5e52c3696cfd..7504d8b52dc6 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CompletionAutoPopupHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CompletionAutoPopupHandler.java @@ -86,7 +86,7 @@ public class CompletionAutoPopupHandler extends TypedHandlerDelegate { } final CharSequence text = editor.getDocument().getCharsSequence(); - final int offset = editor.getCaretModel().getOffset(); + final int offset = editor.getSelectionModel().hasSelection() ? editor.getSelectionModel().getSelectionEnd() : editor.getCaretModel().getOffset(); if (text.length() > offset && Character.isUnicodeIdentifierPart(text.charAt(offset))) { return Result.CONTINUE; }