1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-15 19:31:47 +02:00

Fix repeating change action with count

Fixes VIM-3729
This commit is contained in:
Matt Ellis
2024-11-28 23:08:37 +00:00
committed by Alex Pláte
parent 63297e685c
commit a005eb0612
2 changed files with 17 additions and 2 deletions
src/test/java/org/jetbrains/plugins/ideavim/action/change/change
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/change/change

@@ -194,4 +194,16 @@ Mode.INSERT,
fun testLastSymbolInWord() {
doTest("cw", "fo${c}o", "fo${c}", Mode.INSERT)
}
// VIM-3729
@Test
fun `test change with count applies only to motion when repeated`() {
doTest(listOf("2c3l", "foo<Esc>", "w", "."),
"""
banana banana
""".trimIndent(),
"""
foo foo
""".trimIndent())
}
}

@@ -15,15 +15,18 @@ import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.CommandFlags.FLAG_NO_REPEAT_INSERT
import com.maddyhome.idea.vim.command.DuplicableOperatorAction
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.EnumSet
@CommandOrMotion(keys = ["c"], modes = [Mode.NORMAL])
class ChangeMotionAction : ChangeInInsertSequenceAction(), DuplicableOperatorAction {
override val type: Command.Type = Command.Type.CHANGE
override val flags: EnumSet<CommandFlags> = enumSetOf(FLAG_NO_REPEAT_INSERT)
override val argumentType: Argument.Type = Argument.Type.MOTION
override val duplicateWith: Char = 'c'
override fun executeInInsertSequence(