forked from qt-creator/qt-creator
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: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -548,6 +548,16 @@ void FakeVimPlugin::test_vim_insert()
|
|||||||
data.setText("abc" N "de" X "f" N "" N "jkl" N "mno");
|
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");
|
KEYS("<c-v>2jh" "2I" "XYZ<esc>", "abc" N "d" X "XYZXYZef" N "" N "jXYZXYZkl" N "mno");
|
||||||
INTEGRITY(false);
|
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()
|
void FakeVimPlugin::test_vim_fFtT()
|
||||||
|
|||||||
@@ -3548,7 +3548,6 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
|
|||||||
if (atEndOfLine())
|
if (atEndOfLine())
|
||||||
moveLeft();
|
moveLeft();
|
||||||
} else if (input.is('I')) {
|
} else if (input.is('I')) {
|
||||||
setUndoPosition();
|
|
||||||
if (isVisualMode()) {
|
if (isVisualMode()) {
|
||||||
initVisualBlockInsertMode(QLatin1Char('I'));
|
initVisualBlockInsertMode(QLatin1Char('I'));
|
||||||
} else {
|
} else {
|
||||||
@@ -3559,6 +3558,7 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
|
|||||||
moveToFirstNonBlankOnLine();
|
moveToFirstNonBlankOnLine();
|
||||||
//m_tc.clearSelection();
|
//m_tc.clearSelection();
|
||||||
}
|
}
|
||||||
|
setUndoPosition();
|
||||||
breakEditBlock();
|
breakEditBlock();
|
||||||
enterInsertMode();
|
enterInsertMode();
|
||||||
} else if (input.isControl('i')) {
|
} else if (input.isControl('i')) {
|
||||||
@@ -4263,6 +4263,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
|
|||||||
} else if (!input.text().isEmpty()) {
|
} else if (!input.text().isEmpty()) {
|
||||||
insert = input.text();
|
insert = input.text();
|
||||||
insertInInsertMode(insert);
|
insertInInsertMode(insert);
|
||||||
|
insert.replace(_("<"), _("<LT>"));
|
||||||
} else {
|
} else {
|
||||||
// We don't want fancy stuff in insert mode.
|
// We don't want fancy stuff in insert mode.
|
||||||
return EventHandled;
|
return EventHandled;
|
||||||
|
|||||||
Reference in New Issue
Block a user