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

VIM-404 Fixed 'O' at the first line

This commit is contained in:
Andrey Vlasovskikh 2013-03-26 15:51:15 +04:00
parent befcf4298f
commit ca8026f612
3 changed files with 10 additions and 3 deletions
index.txt
src/com/maddyhome/idea/vim/group
test/org/jetbrains/plugins/ideavim/action

View File

@ -65,6 +65,8 @@ tag char note action in Normal mode ~
|count| 9 "
|F| F{char} 1 cursor to the Nth occurrence of {char} to
the left
|O| O 2 begin a new line above the cursor and
insert text, repeat N times
|P| ["x]P 2 put the text [from buffer x] before the
cursor N times
|T| T{char} 1 cursor till after Nth occurrence of {char}

View File

@ -171,9 +171,7 @@ public class ChangeGroup extends AbstractActionGroup {
if (state.getMode() != CommandState.Mode.REPEAT) {
KeyHandler.executeAction("VimEditorEnter", context);
}
else {
MotionGroup.moveCaret(editor, CommandGroups.getInstance().getMotion().moveCaretVertical(editor, -1));
}
MotionGroup.moveCaret(editor, CommandGroups.getInstance().getMotion().moveCaretVertical(editor, -1));
}
}
else {

View File

@ -240,6 +240,13 @@ public class ChangeActionTest extends VimTestCase {
"fo<caret>\n");
}
// VIM-404 |O|
public void testInsertNewLineAboveFirstLine() {
doTest(stringToKeys("Obar"),
"fo<caret>o\n",
"bar\nfoo\n");
}
private void doTest(final List<KeyStroke> keys, String before, String after) {
myFixture.configureByText("a.java", before);
final Editor editor = myFixture.getEditor();