fakevim: Stop dot command or mapping after an unhandled input

Stop processing dot command or user mapping after it's no longer valid.

For example do not process the "text" part of command "ci)text" if
cursor is not in parenthesis block or "ctXtext" if character 'X' was not
found on current line after cursor. In these cases insert mode is not
set.

Change-Id: I54588f3beeb803e42a566f6381352aff7bb602c7
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Lukas Holecek
2012-11-06 17:29:04 +01:00
committed by hjk
parent 5debabc410
commit 88814c64b5
2 changed files with 69 additions and 25 deletions

View File

@@ -823,6 +823,12 @@ void FakeVimPlugin::test_vim_block_selection()
KEYS("di(", "((" X "))");
data.setText("\"\"");
KEYS("di\"", "\"" X "\"");
// repeat change inner
data.setText("(abc)" N "def" N "(ghi)");
KEYS("ci(xyz<esc>", "(xy" X "z)" N "def" N "(ghi)");
KEYS("j.", "(xyz)" N "de" X "f" N "(ghi)");
KEYS("j.", "(xyz)" N "def" N "(xy" X "z)");
}
void FakeVimPlugin::test_vim_repeat()
@@ -1785,6 +1791,20 @@ void FakeVimPlugin::test_map()
KEYS("rj", "kk" X "j");
data.doCommand("unmap l|unmap k|unmap j");
// bad mapping
data.setText(X "abc" N "def");
data.doCommand("map X Zxx");
KEYS("X", X "abc" N "def");
// cancelled mapping
data.doCommand("map X fxxx");
KEYS("X", X "abc" N "def");
data.doCommand("map X ciXxx");
KEYS("X", X "abc" N "def");
data.doCommand("map Y Xxx");
KEYS("Y", X "abc" N "def");
data.doCommand("unmap X|unmap Y");
NOT_IMPLEMENTED
// <C-o>
data.setText("abc def");