diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/block/prompt/TerminalPromptModelImpl.kt b/plugins/terminal/src/org/jetbrains/plugins/terminal/block/prompt/TerminalPromptModelImpl.kt index 13e29759dc49..5f7659b84c77 100644 --- a/plugins/terminal/src/org/jetbrains/plugins/terminal/block/prompt/TerminalPromptModelImpl.kt +++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/block/prompt/TerminalPromptModelImpl.kt @@ -96,7 +96,7 @@ internal class TerminalPromptModelImpl( @RequiresEdt private fun doUpdatePrompt(renderingInfo: TerminalPromptRenderingInfo) { DocumentUtil.writeInRunUndoTransparentAction { - document.guardedBlocks.forEach { document.removeGuardedBlock(it) } + document.clearGuardedBlocks() document.replaceString(0, commandStartOffset, renderingInfo.text) document.createGuardedBlock(0, renderingInfo.text.length) } @@ -175,5 +175,9 @@ internal class TerminalPromptModelImpl( addRangeHighlighter(highlighting.startOffset, highlighting.endOffset, HighlighterLayer.SYNTAX, highlighting.textAttributesProvider.getTextAttributes(), HighlighterTargetArea.EXACT_RANGE) } + + private fun DocumentEx.clearGuardedBlocks() { + this.guardedBlocks.forEach { removeGuardedBlock(it) } + } } } \ No newline at end of file