1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-04 07:34:03 +02:00

Use the read action to get the caret offset in EditorSelectionHandler

This commit is contained in:
Alex Plate 2025-02-26 10:13:45 +02:00
parent a5ac2e9ca7
commit 0b7c86fa7e
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F

View File

@ -590,9 +590,9 @@ internal object VimListenerManager {
// and dragging left or vertically upwards, the last character prior to EOL
// remains unselected. It's not clear why this happens, but this code fixes it.
val caret = editor.caretModel.currentCaret
val caretOffset = caret.offset
val lineStart = ijVimEditor.getLineStartForOffset(caret.offset)
val lineEnd = ijVimEditor.getLineEndForOffset(caret.offset)
val caretOffset = ApplicationManager.getApplication().runReadAction<Int> { caret.offset }
val lineStart = ijVimEditor.getLineStartForOffset(caretOffset)
val lineEnd = ijVimEditor.getLineEndForOffset(caretOffset)
val startOffset = selectionEvent.newRange.startOffset
val endOffset = selectionEvent.newRange.endOffset