1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-29 19:34:09 +02:00

Fix previous word end motion at start of file

This commit is contained in:
Matt Ellis 2025-01-06 23:21:44 +00:00 committed by Alex Pláte
parent b534708a99
commit be1cc67566
3 changed files with 6 additions and 14 deletions
src/test/java/org/jetbrains/plugins/ideavim/action/motion/text
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api

View File

@ -8,7 +8,6 @@
package org.jetbrains.plugins.ideavim.action.motion.text package org.jetbrains.plugins.ideavim.action.motion.text
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -107,11 +106,9 @@ class MotionBigWordEndLeftActionTest : VimTestCase() {
) )
} }
// TODO: Fix this bug
@VimBehaviorDiffers(originalVimAfter = "${c}Lorem ipsum")
@Test @Test
fun `test move to previous word end on first word moves to start of file`() { fun `test move to previous word end on first word moves to start of file`() {
doTest("gE", "Lore${c}m ipsum", "Lore${c}m ipsum") doTest("gE", "Lore${c}m ipsum", "${c}Lorem ipsum")
} }
@Test @Test
@ -125,11 +122,9 @@ class MotionBigWordEndLeftActionTest : VimTestCase() {
assertPluginError(true) assertPluginError(true)
} }
// TODO: Fix this bug
@VimBehaviorDiffers(originalVimAfter = "${c}Lorem ipsum")
@Test @Test
fun `test move to previous word end with large count moves to start of file without reporting error`() { fun `test move to previous word end with large count moves to start of file without reporting error`() {
doTest("100gE", "Lorem ip${c}sum", "Lore${c}m ipsum") doTest("100gE", "Lorem ip${c}sum", "${c}Lorem ipsum")
assertPluginError(false) assertPluginError(false)
} }
} }

View File

@ -8,7 +8,6 @@
package org.jetbrains.plugins.ideavim.action.motion.text package org.jetbrains.plugins.ideavim.action.motion.text
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -107,11 +106,9 @@ class MotionWordEndLeftActionTest : VimTestCase() {
) )
} }
// TODO: Fix this bug
@VimBehaviorDiffers(originalVimAfter = "${c}Lorem ipsum")
@Test @Test
fun `test move to previous word end on first word moves to start of file`() { fun `test move to previous word end on first word moves to start of file`() {
doTest("ge", "Lore${c}m ipsum", "Lore${c}m ipsum") doTest("ge", "Lore${c}m ipsum", "${c}Lorem ipsum")
} }
@Test @Test
@ -125,11 +122,9 @@ class MotionWordEndLeftActionTest : VimTestCase() {
assertPluginError(true) assertPluginError(true)
} }
// TODO: Fix this bug
@VimBehaviorDiffers(originalVimAfter = "${c}Lorem ipsum")
@Test @Test
fun `test move to previous word end with large count moves to start of file without reporting error`() { fun `test move to previous word end with large count moves to start of file without reporting error`() {
doTest("100ge", "Lorem ip${c}sum", "Lore${c}m ipsum") doTest("100ge", "Lorem ip${c}sum", "${c}Lorem ipsum")
assertPluginError(false) assertPluginError(false)
} }
} }

View File

@ -422,6 +422,8 @@ abstract class VimSearchHelperBase : VimSearchHelper {
} }
} else if (pos == size) { } else if (pos == size) {
res = size - 1 res = size - 1
} else if (pos <= 0) {
res = 0
} }
return res return res
} }