From f71b4cbc5a193c8c50964506cc6d5207d5febb41 Mon Sep 17 00:00:00 2001 From: Konstantin Hudyakov Date: Tue, 21 Oct 2025 09:42:25 +0300 Subject: [PATCH] [terminal] IJPL-213971 Fix exceptions caused by out-of-bounds offsets in TerminalBlocksDecorator Always check that block start offset is in the model bounds. GitOrigin-RevId: 4ed08212375b2fdb75c4c0e0ad9f5207c8240a4d --- .../terminal/frontend/view/impl/TerminalBlocksDecorator.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalBlocksDecorator.kt b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalBlocksDecorator.kt index b68b6098fa60..1d625ed5c425 100644 --- a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalBlocksDecorator.kt +++ b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalBlocksDecorator.kt @@ -93,7 +93,7 @@ internal class TerminalBlocksDecorator( } private fun createPromptDecoration(block: TerminalCommandBlock): BlockDecoration { - val startOffset = block.startOffset + val startOffset = block.startOffset.coerceAtLeast(outputModel.startOffset) val endOffset = block.endOffset val topInlay = createTopInlay(block) @@ -111,7 +111,7 @@ internal class TerminalBlocksDecorator( } private fun createFinishedBlockDecoration(block: TerminalCommandBlock): BlockDecoration { - val startOffset = block.startOffset + val startOffset = block.startOffset.coerceAtLeast(outputModel.startOffset) // End offset of the finished block is located after the line break. // But we need to place the end inlay before the line break and limit the height of the highlighters to the block content. // So adjust the offset by 1.