summaryrefslogtreecommitdiff
path: root/platform/lang-impl/src/com/intellij/execution/impl/ConsoleTokenUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/lang-impl/src/com/intellij/execution/impl/ConsoleTokenUtil.java')
-rw-r--r--platform/lang-impl/src/com/intellij/execution/impl/ConsoleTokenUtil.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleTokenUtil.java b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleTokenUtil.java
index a81de3e33126..0c798cd18c26 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleTokenUtil.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleTokenUtil.java
@@ -133,7 +133,12 @@ class ConsoleTokenUtil {
if (mergeWithThePreviousSameTypeToken && startOffset > 0) {
RangeMarker prevMarker = findTokenMarker(editor, project, startOffset - 1);
ConsoleViewContentType prevMarkerType = prevMarker == null ? null : getTokenType(prevMarker);
- if (contentType.equals(prevMarkerType)) {
+ int prevMarkerEndOffset = prevMarkerType == null ? -1 : prevMarker.getEndOffset();
+ if (contentType.equals(prevMarkerType) &&
+ prevMarkerEndOffset >= 0 &&
+ prevMarkerEndOffset < editor.getDocument().getTextLength() &&
+ // must not merge tokens with end line because user input should be separated by new lines
+ editor.getDocument().getCharsSequence().charAt(prevMarkerEndOffset - 1) != '\n') {
startOffset = prevMarker.getStartOffset();
prevMarker.dispose();
}