mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[ai-completion] IJPL-195112 Fix out of bounds document access on terminal resize
GitOrigin-RevId: 53878f683772ff41c0298016ad19483b46e746ff
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9476359d44
commit
fefb10c639
@@ -465,6 +465,10 @@ internal class ReworkedTerminalView(
|
||||
val inlineCompletionTypingSession = InlineCompletion.getHandlerOrNull(editor)?.typingSessionTracker
|
||||
val lastBlock = editor.getUserData(TerminalBlocksModel.KEY)?.blocks?.lastOrNull() ?: return
|
||||
val lastBlockCommandStartIndex = if (lastBlock.commandStartOffset != -1) lastBlock.commandStartOffset else lastBlock.startOffset
|
||||
|
||||
// When resizing the terminal, the blocks model may fall out of sync for a short time.
|
||||
// These updates will never trigger a completion, so we return early to avoid reading out of bounds.
|
||||
if (lastBlockCommandStartIndex >= editor.document.textLength) return
|
||||
val curCommandText = editor.document.text.substring(lastBlockCommandStartIndex, editor.document.textLength).trim()
|
||||
|
||||
if (isTypeAhead) {
|
||||
|
||||
Reference in New Issue
Block a user