mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-01-05 01:42:49 +01:00
Fix an issue with disposed caret when moving up
There was an issue that when we enter visual block, move up, then try to switch to the visual line, we get a disposed caret issue. This was caused by the fact that we get the list of carets, then process them one by one. However, as we update the first caret, the second gets disposed.
This commit is contained in:
parent
a703afbef9
commit
a62cc3618c
src/test/java/org/jetbrains/plugins/ideavim/action/motion/visual
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api
@ -131,4 +131,28 @@ class VisualToggleLineModeActionTest : VimTestCase() {
|
||||
typeText("V")
|
||||
assertState(VimStateMachine.Mode.SELECT, VimStateMachine.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `enter visual line from visual block with motion up`() {
|
||||
doTest(
|
||||
"<C-V>khV",
|
||||
"""
|
||||
Lorem Ipsum
|
||||
|
||||
Lorem ipsum dolor sit amet,
|
||||
consectetur adipiscing elit
|
||||
Sed in${c} orci mauris.
|
||||
Cras id tellus in ex imperdiet egestas.
|
||||
""".trimIndent(),
|
||||
"""
|
||||
Lorem Ipsum
|
||||
|
||||
Lorem ipsum dolor sit amet,
|
||||
${s}conse${c}ctetur adipiscing elit
|
||||
Sed in orci mauris.
|
||||
${se}Cras id tellus in ex imperdiet egestas.
|
||||
""".trimIndent(),
|
||||
VimStateMachine.Mode.VISUAL, VimStateMachine.SubMode.VISUAL_LINE
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public abstract class VimVisualMotionGroupBase : VimVisualMotionGroup {
|
||||
|
||||
// Update visual subMode with new sub subMode
|
||||
editor.subMode = subMode
|
||||
for (caret in editor.carets()) {
|
||||
editor.forEachCaret { caret ->
|
||||
caret.vimUpdateEditorSelection()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user