forked from qt-creator/qt-creator
FakeVim: Remember that cursor is at the end of line
Change-Id: I62098a409028593664b813931d5974de5e787993 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -421,6 +421,13 @@ void FakeVimPlugin::test_vim_movement()
|
|||||||
data.setText("abc def" N "ghi");
|
data.setText("abc def" N "ghi");
|
||||||
KEYS("$a", "abc def" X 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
|
// paragraph movement
|
||||||
data.setText("abc" N N "def");
|
data.setText("abc" N N "def");
|
||||||
KEYS("}", "abc" N X N "def");
|
KEYS("}", "abc" N X N "def");
|
||||||
|
@@ -4220,6 +4220,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
|
|||||||
moveBehindEndOfLine();
|
moveBehindEndOfLine();
|
||||||
move = true;
|
move = true;
|
||||||
setTargetColumn();
|
setTargetColumn();
|
||||||
|
m_targetColumn = -1;
|
||||||
} else if (input.isReturn() || input.isControl('j') || input.isControl('m')) {
|
} else if (input.isReturn() || input.isControl('j') || input.isControl('m')) {
|
||||||
joinPreviousEditBlock();
|
joinPreviousEditBlock();
|
||||||
m_submode = NoSubMode;
|
m_submode = NoSubMode;
|
||||||
@@ -6686,7 +6687,12 @@ void FakeVimHandler::Private::enterInsertMode()
|
|||||||
m_subsubmode = NoSubSubMode;
|
m_subsubmode = NoSubSubMode;
|
||||||
m_lastInsertion.clear();
|
m_lastInsertion.clear();
|
||||||
m_oldPosition = position();
|
m_oldPosition = position();
|
||||||
|
if (g.returnToMode != InsertMode) {
|
||||||
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)
|
void FakeVimHandler::Private::initVisualBlockInsertMode(QChar command)
|
||||||
|
Reference in New Issue
Block a user