1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-06-18 09:40:02 +02:00

Fix select mode for immutable caret

Due to implementation details, caret cannot be moved after setting selection
This commit is contained in:
Filipp Vakhitov 2024-09-16 00:44:24 +03:00 committed by Alex Pláte
parent 63f6e73223
commit cde9bc94e6

View File

@ -37,10 +37,10 @@ class SelectEnableCharacterModeAction : VimActionHandler.SingleExecution() {
): Boolean { ): Boolean {
editor.nativeCarets().sortedByDescending { it.offset }.forEach { caret -> editor.nativeCarets().sortedByDescending { it.offset }.forEach { caret ->
val lineEnd = editor.getLineEndForOffset(caret.offset) val lineEnd = editor.getLineEndForOffset(caret.offset)
val offset = caret.offset
val nextOffset = (caret.offset + 1).coerceAtMost(lineEnd) val nextOffset = (caret.offset + 1).coerceAtMost(lineEnd)
caret.vimSetSystemSelectionSilently(caret.offset, nextOffset) val updatedCaret = caret.moveToInlayAwareOffset(nextOffset)
val updatedCaret = editor.findLastVersionOfCaret(caret) ?: return@forEach updatedCaret.vimSetSystemSelectionSilently(offset, nextOffset)
updatedCaret.moveToInlayAwareOffset(nextOffset)
} }
return injector.visualMotionGroup.enterSelectMode(editor, SelectionType.CHARACTER_WISE) return injector.visualMotionGroup.enterSelectMode(editor, SelectionType.CHARACTER_WISE)
} }