Commit 9a774254 authored by Lukas Holecek's avatar Lukas Holecek Committed by hjk
Browse files

fakevim: Escape insert command and correct undo position for "I"



Escape inserted string for repeatition, e.g. command "2i<up>" will
insert text "<up><up>".

Undo position for "I" is start of selection or line.

Change-Id: Ic7e6d8dbf712197b36be20b17ef6d1c0814b1a51
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent b9511fe1
......@@ -548,6 +548,16 @@ void FakeVimPlugin::test_vim_insert()
data.setText("abc" N "de" X "f" N "" N "jkl" N "mno");
KEYS("<c-v>2jh" "2I" "XYZ<esc>", "abc" N "d" X "XYZXYZef" N "" N "jXYZXYZkl" N "mno");
INTEGRITY(false);
// repeat insert with special characters
data.setText("ab" X "c" N "def");
KEYS("2i<lt>down><esc>", "ab<down><down" X ">c" N "def");
INTEGRITY(false);
data.setText(" ab" X "c" N " def");
KEYS("2I<lt>end><esc>", " <end><end" X ">abc" N " def");
KEYS("u", " " X "abc" N " def");
KEYS(".", " <end><end" X ">abc" N " def");
}
void FakeVimPlugin::test_vim_fFtT()
......
......@@ -3548,7 +3548,6 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
if (atEndOfLine())
moveLeft();
} else if (input.is('I')) {
setUndoPosition();
if (isVisualMode()) {
initVisualBlockInsertMode(QLatin1Char('I'));
} else {
......@@ -3559,6 +3558,7 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
moveToFirstNonBlankOnLine();
//m_tc.clearSelection();
}
setUndoPosition();
breakEditBlock();
enterInsertMode();
} else if (input.isControl('i')) {
......@@ -4263,6 +4263,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
} else if (!input.text().isEmpty()) {
insert = input.text();
insertInInsertMode(insert);
insert.replace(_("<"), _("<LT>"));
} else {
// We don't want fancy stuff in insert mode.
return EventHandled;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment