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

Fixed :quit command (not all forms recognized)

This commit is contained in:
rmaddy 2004-12-10 22:31:18 +00:00
parent 6b308bbdfe
commit 79f33e9607
6 changed files with 46 additions and 4 deletions

View File

@ -5,6 +5,7 @@ Bug Fixes
- The Escape key is passed up to IDEA if not used by VIM first. This fix solves
minor issues such as not being able to clear highlighted text using the
Ctrl-Shift-F7, for example.
- :quit command now works in all forms (e.g. :q, :qu, :qui, :quit).
0.8.3 from 0.8.2
Bug Fixes

View File

@ -1,6 +1,5 @@
Bugs to fix:
- :q works but :qu :qui and :quit don't.
x Using column selection causes exception.
- change commands in visual mode leaves you in visual mode - shouldn't
- Split text when typing fast after o command.

View File

@ -25,6 +25,8 @@ import com.maddyhome.idea.vim.helper.MessageHelper;
import com.maddyhome.idea.vim.helper.Msg;
import com.maddyhome.idea.vim.undo.UndoManager;
import java.util.Arrays;
/**
* Base class for all Ex command handlers.
*/
@ -290,6 +292,18 @@ public abstract class CommandHandler
*/
public abstract boolean execute(Editor editor, DataContext context, ExCommand cmd) throws ExException;
public String toString()
{
StringBuffer res = new StringBuffer();
res.append(this.getClass().getName()).append("{");
res.append("names=" + Arrays.asList(names));
res.append(",argFlags=" + argFlags);
res.append(",optFlags=" + optFlags);
res.append("}");
return res.toString();
}
protected CommandName[] names;
protected int argFlags;
protected int optFlags;

View File

@ -40,6 +40,17 @@ public class CommandName
return optional;
}
public String toString()
{
StringBuffer buf = new StringBuffer();
buf.append("CommandName{");
buf.append("required=").append(required);
buf.append(",optional=").append(optional);
buf.append('}');
return buf.toString();
}
private String required;
private String optional;
}

View File

@ -59,6 +59,17 @@ public class CommandNode
this.command = command;
}
public String toString()
{
StringBuffer res = new StringBuffer();
res.append("CommandNode{");
res.append("command=" + command);
res.append(",children=" + nodes);
res.append("}");
return res.toString();
}
private CommandHandler command;
private HashMap nodes = new HashMap();
}

View File

@ -29,6 +29,7 @@ import com.maddyhome.idea.vim.common.Register;
import com.maddyhome.idea.vim.ex.handler.CmdFilterHandler;
import com.maddyhome.idea.vim.ex.handler.CopyTextHandler;
import com.maddyhome.idea.vim.ex.handler.DeleteLinesHandler;
import com.maddyhome.idea.vim.ex.handler.DigraphHandler;
import com.maddyhome.idea.vim.ex.handler.DumpLineHandler;
import com.maddyhome.idea.vim.ex.handler.EditFileHandler;
import com.maddyhome.idea.vim.ex.handler.ExitHandler;
@ -43,6 +44,7 @@ import com.maddyhome.idea.vim.ex.handler.MarkHandler;
import com.maddyhome.idea.vim.ex.handler.MarksHandler;
import com.maddyhome.idea.vim.ex.handler.MoveTextHandler;
import com.maddyhome.idea.vim.ex.handler.NextFileHandler;
import com.maddyhome.idea.vim.ex.handler.NoHLSearchHandler;
import com.maddyhome.idea.vim.ex.handler.OnlyHandler;
import com.maddyhome.idea.vim.ex.handler.PreviousFileHandler;
import com.maddyhome.idea.vim.ex.handler.PromptFindHandler;
@ -66,13 +68,11 @@ import com.maddyhome.idea.vim.ex.handler.WriteNextFileHandler;
import com.maddyhome.idea.vim.ex.handler.WritePreviousFileHandler;
import com.maddyhome.idea.vim.ex.handler.WriteQuitHandler;
import com.maddyhome.idea.vim.ex.handler.YankLinesHandler;
import com.maddyhome.idea.vim.ex.handler.DigraphHandler;
import com.maddyhome.idea.vim.ex.handler.NoHLSearchHandler;
import com.maddyhome.idea.vim.ex.range.AbstractRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.helper.ApiHelper;
import com.maddyhome.idea.vim.helper.MessageHelper;
import com.maddyhome.idea.vim.helper.Msg;
import com.maddyhome.idea.vim.helper.ApiHelper;
/**
* Maintains a tree of Ex commands based on the required and optional parts of the command names. Parses and
@ -156,6 +156,8 @@ public class CommandParser
new WritePreviousFileHandler();
new WriteQuitHandler();
new YankLinesHandler();
//logger.debug("root=" + root);
}
/**
@ -674,6 +676,10 @@ public class CommandParser
{
cn = node.addChild(text.charAt(i), handler);
}
else if (cn.getCommandHandler() == null)
{
cn.setCommandHandler(handler);
}
node = cn;
}