forked from qt-creator/qt-creator
FakeVim: Don't handle user mapping in some commands
Don't handle user mappings in commands that cannot be followed by movement command. For example, key "<SPACE>" in after "t" command cannot be handled as user mapping. Change-Id: I97582d23ae637b30b1058b9d2b381a869bbebb79 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -2291,6 +2291,15 @@ void FakeVimPlugin::test_map()
|
||||
data.setText("abc" N "def");
|
||||
data.doCommand(QString::fromUtf8("no \xc3\xb8 l|no l k|no k j|no j h"));
|
||||
KEYS(QString::fromUtf8("\xc3\xb8"), "a" X "bc" N "def");
|
||||
|
||||
// Don't handle mapping in sub-modes that are not followed by movement command.
|
||||
data.setText("abc" N "def");
|
||||
data.doCommand("map <SPACE> A<cr>xy z<esc><left><left>");
|
||||
KEYS("<space>", "abc" N "x" X "y z" N "def");
|
||||
KEYS("r<space>", "abc" N "x" X " z" N "def");
|
||||
KEYS("f<space>", "abc" N "x " X " z" N "def");
|
||||
KEYS("t<space>", "abc" N "x " X " z" N "def");
|
||||
data.doCommand("unmap <SPACE>");
|
||||
}
|
||||
|
||||
void FakeVimPlugin::test_vim_command_cc()
|
||||
|
||||
@@ -2489,7 +2489,15 @@ void FakeVimHandler::Private::endMapping()
|
||||
|
||||
bool FakeVimHandler::Private::canHandleMapping()
|
||||
{
|
||||
return m_subsubmode != SearchSubSubMode
|
||||
// Don't handle user mapping in sub-modes that cannot be followed by movement and in "noremap".
|
||||
return m_subsubmode == NoSubSubMode
|
||||
&& m_submode != RegisterSubMode
|
||||
&& m_submode != WindowSubMode
|
||||
&& m_submode != ZSubMode
|
||||
&& m_submode != CapitalZSubMode
|
||||
&& m_submode != ReplaceSubMode
|
||||
&& m_submode != MacroRecordSubMode
|
||||
&& m_submode != MacroExecuteSubMode
|
||||
&& (g.mapStates.isEmpty() || !g.mapStates.last().noremap);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user