From f14159a288778537fde7382acce3b8e2e85571a0 Mon Sep 17 00:00:00 2001 From: Kirill Starkov Date: Fri, 16 Feb 2024 10:35:08 +0700 Subject: [PATCH] fix end of file behaviour --- .../com/smallcloud/refactai/modes/completion/CompletionMode.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/smallcloud/refactai/modes/completion/CompletionMode.kt b/src/main/kotlin/com/smallcloud/refactai/modes/completion/CompletionMode.kt index c006e891..c7685110 100644 --- a/src/main/kotlin/com/smallcloud/refactai/modes/completion/CompletionMode.kt +++ b/src/main/kotlin/com/smallcloud/refactai/modes/completion/CompletionMode.kt @@ -88,7 +88,7 @@ class CompletionMode( if (!event.force) { val docEvent = event.event ?: return - if (docEvent.offset + docEvent.newLength > text.length) return + if (docEvent.offset + docEvent.newLength > editor.document.text.length) return if (docEvent.newLength + docEvent.oldLength <= 0) return maybeState = EditorTextState( editor,