Commit 2622eb24 authored by Lukas Holecek's avatar Lukas Holecek Committed by hjk
Browse files

FakeVim: Remember that cursor is at the end of line



Change-Id: I62098a409028593664b813931d5974de5e787993
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 402affa9
......@@ -421,6 +421,13 @@ void FakeVimPlugin::test_vim_movement()
data.setText("abc def" N "ghi");
KEYS("$a", "abc def" X N "ghi");
data.setText("abc" N "def ghi");
KEYS("i<end><down>", "abc" N "def ghi" X);
data.setText("abc" N "def ghi");
KEYS("<end>i<down>", "abc" N "de" X "f ghi");
data.setText("abc" N "def ghi");
KEYS("<end>a<down>", "abc" N "def" X " ghi");
// paragraph movement
data.setText("abc" N N "def");
KEYS("}", "abc" N X N "def");
......
......@@ -4220,6 +4220,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
moveBehindEndOfLine();
move = true;
setTargetColumn();
m_targetColumn = -1;
} else if (input.isReturn() || input.isControl('j') || input.isControl('m')) {
joinPreviousEditBlock();
m_submode = NoSubMode;
......@@ -6686,7 +6687,12 @@ void FakeVimHandler::Private::enterInsertMode()
m_subsubmode = NoSubSubMode;
m_lastInsertion.clear();
m_oldPosition = position();
g.returnToMode = InsertMode;
if (g.returnToMode != InsertMode) {
g.returnToMode = InsertMode;
// If entering insert mode from command mode, m_targetColumn shouldn't be -1 (end of line).
if (m_targetColumn == -1)
setTargetColumn();
}
}
void FakeVimHandler::Private::initVisualBlockInsertMode(QChar command)
......
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