1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-02-25 02:46:01 +01:00

VIM-2099 Fix operations with backward inclusive motions

This commit is contained in:
Alex Plate 2020-09-03 10:03:54 +03:00
parent 86d6876db4
commit 33f8a00679
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
3 changed files with 15 additions and 1 deletions
CHANGES.md
src/com/maddyhome/idea/vim/group
test/org/jetbrains/plugins/ideavim/action/motion/updown

View File

@ -28,6 +28,7 @@ To Be Released
**Fixes:**
* [VIM-2097](https://youtrack.jetbrains.com/issue/VIM-2097) Do not apply mappings for register selecting
* [VIM-2080](https://youtrack.jetbrains.com/issue/VIM-2080) Fix S command with count
* [VIM-2099](https://youtrack.jetbrains.com/issue/VIM-2099) Fix operations with backward inclusive motions
0.59, 2020-08-25
------------

View File

@ -112,7 +112,12 @@ public class MotionGroup {
// If inclusive, add the last character to the range
if (action.getMotionType() == MotionType.INCLUSIVE && end < EditorHelperRt.getFileSize(editor)) {
end++;
if (start > end) {
start ++;
}
else {
end++;
}
}
}
else if (cmd.getAction() instanceof TextObjectActionHandler) {

View File

@ -193,4 +193,12 @@ class MotionPercentOrMatchActionTest : VimTestCase() {
doTest("%", """ "I found ${c}it in \\\"a (legendary) land" """,
""" "I found it in \\\"a (legendary${c}) land" """, CommandState.Mode.COMMAND, CommandState.SubMode.NONE)
}
fun `test deleting with percent motion backward`() {
doTest("d%", "(foo bar$c)", c, CommandState.Mode.COMMAND, CommandState.SubMode.NONE)
}
fun `test deleting with percent motion`() {
doTest("d%", "$c(foo bar)", c, CommandState.Mode.COMMAND, CommandState.SubMode.NONE)
}
}