1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-21 07:34:05 +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 {
editor.nativeCarets().sortedByDescending { it.offset }.forEach { caret ->
val lineEnd = editor.getLineEndForOffset(caret.offset)
val offset = caret.offset
val nextOffset = (caret.offset + 1).coerceAtMost(lineEnd)
caret.vimSetSystemSelectionSilently(caret.offset, nextOffset)
val updatedCaret = editor.findLastVersionOfCaret(caret) ?: return@forEach
updatedCaret.moveToInlayAwareOffset(nextOffset)
val updatedCaret = caret.moveToInlayAwareOffset(nextOffset)
updatedCaret.vimSetSystemSelectionSilently(offset, nextOffset)
}
return injector.visualMotionGroup.enterSelectMode(editor, SelectionType.CHARACTER_WISE)
}