diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/highlight/KotlinHistoryHighlighter.kt b/idea/idea-repl/src/org/jetbrains/kotlin/console/highlight/KotlinHistoryHighlighter.kt index f6253685cc5..2718887d3ab 100644 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/highlight/KotlinHistoryHighlighter.kt +++ b/idea/idea-repl/src/org/jetbrains/kotlin/console/highlight/KotlinHistoryHighlighter.kt @@ -41,30 +41,31 @@ public class KotlinHistoryHighlighter(private val runner: KotlinConsoleRunner ) fun printNewCommandInHistory(trimmedCommandText: String) { val historyEditor = consoleView.historyViewer - addLineBreakIfNeeded(historyEditor) - - val consoleEditor = consoleView.consoleEditor - val consoleDocument = consoleEditor.document - consoleDocument.setText(trimmedCommandText) - val startOffset = historyEditor.document.textLength val endOffset = startOffset + trimmedCommandText.length() - LanguageConsoleImpl.printWithHighlighting(consoleView, consoleEditor, TextRange(0, consoleDocument.textLength)) - consoleView.flushDeferredText() + addCommandTextToHistoryEditor(trimmedCommandText) EditorUtil.scrollToTheEnd(historyEditor) - consoleDocument.setText("") addFoldingRegion(historyEditor, startOffset, endOffset, trimmedCommandText) historyEditor.markupModel.addRangeHighlighter( startOffset, endOffset, HighlighterLayer.LAST, null, HighlighterTargetArea.EXACT_RANGE - ) apply { + ).apply { val historyMarker = if (isReadLineMode) ReplIcons.READLINE_MARKER else ReplIcons.COMMAND_MARKER gutterIconRenderer = KotlinConsoleIndicatorRenderer(historyMarker) } } + private fun addCommandTextToHistoryEditor(trimmedCommandText: String) { + val consoleEditor = consoleView.consoleEditor + val consoleDocument = consoleEditor.document + consoleDocument.setText(trimmedCommandText) + LanguageConsoleImpl.printWithHighlighting(consoleView, consoleEditor, TextRange(0, consoleDocument.textLength)) + consoleView.flushDeferredText() + consoleDocument.setText("") + } + private fun addLineBreakIfNeeded(historyEditor: EditorEx) { if (isReadLineMode) return