1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-17 16:31:45 +02:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Andrey Vlasovskikh
e3f57fd647 Updated changelog 2012-11-14 17:50:01 +04:00
Andrey Vlasovskikh
e074105bde VIM-112 Delete a single previous word with <C-W> in insert mode, not all inserted words 2012-11-14 17:08:32 +04:00
Andrey Vlasovskikh
7a8bdfc4fc VIM-321 Updated test number and help index for 'd' and 'count' 2012-11-14 16:05:04 +04:00
Andrey Vlasovskikh
d765eb74ef VIM-312 Fixed IOOBE in delete empty range 2012-11-13 22:44:54 +04:00
Andrey Vlasovskikh
ac654d70fa VIM-318 Fixed executing editor commands for editors not bound to a project 2012-11-13 22:44:44 +04:00
8 changed files with 72 additions and 21 deletions

View File

@@ -4,6 +4,16 @@ The Changelog
History of changes in IdeaVim for the IntelliJ platform.
0.23.115, 2012-11-14
--------------------
A bugfix release.
* VIM-318 Fixed executing editor commands for editors not bound to a project
* VIM-321 Fixed IOOBE in delete empty range
* VIM-112 Delete a single previous word with <C-W> in insert mode, not all inserted words
0.23.111, 2012-11-12
--------------------

View File

@@ -25,6 +25,7 @@ tag char action in Insert mode ~
enter digraph
|i_CTRL-O| CTRL-O execute a single command and return to insert
mode
|i_CTRL-W| CTRL-W delete word before the cursor
==============================================================================
2. Normal mode *normal-index*
@@ -45,6 +46,16 @@ tag char note action in Normal mode ~
({.%#:} only work with put)
|/| /{pattern}<CR> 1 search forward for the Nth occurrence of
{pattern}
|count| 0 1 cursor to the first char of the line
|count| 1 prepend to command to give a count
|count| 2 "
|count| 3 "
|count| 4 "
|count| 5 "
|count| 6 "
|count| 7 "
|count| 8 "
|count| 9 "
|F| F{char} 1 cursor to the Nth occurrence of {char} to
the left
|P| ["x]P 2 put the text [from buffer x] before the
@@ -55,8 +66,10 @@ tag char note action in Normal mode ~
"yy"
|c| ["x]c{motion} 2 delete Nmove text [into buffer x] and start
insert
|d| ["x]d{motion} 2 delete Nmove text [into buffer x]
|f| f{char} 1 cursor to Nth occurrence of {char} to the
right
|i| i 2 insert text before the cursor N times
|p| ["x]p 2 put the text [from register x] after the
cursor N times
|q| q{0-9a-zA-Z"} record typed characters into named register

View File

@@ -23,6 +23,7 @@ import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
@@ -349,13 +350,15 @@ public class KeyHandler {
logger.debug("lastWasBS=" + lastWasBS);
Project project = editor.getProject();
if (cmd.getType().isRead() || (project != null && EditorHelper.canEdit(project, editor))) {
Runnable action = new ActionRunner(editor, context, cmd, key);
if (cmd.getType().isWrite()) {
RunnableHelper.runWriteCommand(project, action, cmd.getActionId(), null);
}
else {
RunnableHelper.runReadCommand(project, action, cmd.getActionId(), null);
if (cmd.getType().isRead() || project == null || EditorHelper.canEdit(project, editor)) {
if (ApplicationManager.getApplication().isDispatchThread()) {
Runnable action = new ActionRunner(editor, context, cmd, key);
if (cmd.getType().isWrite()) {
RunnableHelper.runWriteCommand(project, action, cmd.getActionId(), null);
}
else {
RunnableHelper.runReadCommand(project, action, cmd.getActionId(), null);
}
}
}
else {

View File

@@ -322,19 +322,13 @@ public class ChangeGroup extends AbstractActionGroup {
* @return true if able to delete text, false if not
*/
public boolean insertDeletePreviousWord(Editor editor, DataContext context) {
int deleteTo = insertStart;
int offset = editor.getCaretModel().getOffset();
if (offset == insertStart) {
deleteTo = CommandGroups.getInstance().getMotion().moveCaretToNextWord(editor, -1, false);
final int deleteTo = CommandGroups.getInstance().getMotion().moveCaretToNextWord(editor, -1, false);
if (deleteTo == -1) {
return false;
}
if (deleteTo != -1) {
deleteRange(editor, context, new TextRange(deleteTo, offset), SelectionType.CHARACTER_WISE,false);
return true;
}
return false;
final TextRange range = new TextRange(deleteTo, editor.getCaretModel().getOffset());
deleteRange(editor, context, range, SelectionType.CHARACTER_WISE, false);
return true;
}
/**

View File

@@ -188,7 +188,7 @@ public class RegisterGroup extends AbstractActionGroup {
if (start != -1) {
CommandGroups.getInstance().getMark().setMark(editor, '[', start);
CommandGroups.getInstance().getMark().setMark(editor, ']', end - 1);
CommandGroups.getInstance().getMark().setMark(editor, ']', Math.max(end - 1, 0));
}
return true;

View File

@@ -53,6 +53,13 @@ public class ChangeActionTest extends VimTestCase {
"abcdx.\n");
}
// VIM-321 |d| |count|
public void testDeleteEmptyRange() {
doTest(stringToKeys("d0"),
"<caret>hello\n",
"hello\n");
}
private void doTest(final List<KeyStroke> keys, String before, String after) {
myFixture.configureByText("a.java", before);
final Editor editor = myFixture.getEditor();

View File

@@ -14,7 +14,7 @@ import static com.maddyhome.idea.vim.helper.StringHelper.stringToKeys;
* @author vlan
*/
public class CopyActionTest extends VimTestCase {
// |y| |p|
// |y| |p| |count|
public void testYankPutCharacters() {
typeTextInFile(stringToKeys("y2hp"),
"one two<caret> three\n");

View File

@@ -0,0 +1,24 @@
package org.jetbrains.plugins.ideavim.action;
import org.jetbrains.plugins.ideavim.VimTestCase;
import javax.swing.*;
import java.util.List;
import static com.maddyhome.idea.vim.helper.StringHelper.stringToKeys;
/**
* @author vlan
*/
public class InsertActionTest extends VimTestCase {
// VIM-112 |i| |i_CTRL-W|
public void testInsertDeletePreviousWord() {
final List<KeyStroke> keys = stringToKeys("ione two three");
keys.add(KeyStroke.getKeyStroke("control W"));
typeTextInFile(keys,
"hello\n" +
"<caret>\n");
myFixture.checkResult("hello\n" +
"one two \n");
}
}