[terminal] Refactoring: Extract Document.clearGuardedBlocks()

GitOrigin-RevId: e9532ef212be6bcf6328d169978f0473825e4c46
This commit is contained in:
Vladimir Shefer
2024-09-27 11:47:05 +00:00
committed by intellij-monorepo-bot
parent 87661e68a4
commit 09e0eeb9a5
@@ -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) }
}
}
}