Commit 4f20799a authored by hluk's avatar hluk Committed by hjk

FakeVim: Clear count after insert mode

Change-Id: If02aaecbbbb5e25001d5bafafd0d4228bba5d63e
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent dab57db8
......@@ -541,6 +541,9 @@ void FakeVimPlugin::test_vim_insert()
KEYS("<insert>x<insert>X<left><left><down><esc>", "xXbc" N X "def");
KEYS(".", "xXbc" N "x" X "Xef");
data.setText("abc" N "def");
KEYS("2oXYZ<esc>.", "abc" N "XYZ" N "XYZ" N "XYZ" N "XY" X "Z" N "def");
// delete in insert mode is part of dot command
data.setText("abc" N "def");
KEYS("iX<delete>Y", "XY" X "bc" N "def");
......
......@@ -1442,6 +1442,7 @@ public:
void finishMovement(const QString &dotCommandMovement = QString());
void finishMovement(const QString &dotCommandMovement, int count);
void resetCommandMode();
void clearCommandMode();
QTextCursor search(const SearchData &sd, int startPos, int count, bool showMessages);
void search(const SearchData &sd, bool showMessages = true);
void searchNext(bool forward = true);
......@@ -2828,16 +2829,7 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommandMovement)
void FakeVimHandler::Private::resetCommandMode()
{
m_subsubmode = NoSubSubMode;
m_submode = NoSubMode;
m_movetype = MoveInclusive;
m_mvcount.clear();
m_opcount.clear();
m_gflag = false;
m_register = '"';
//m_tc.clearSelection();
m_rangemode = RangeCharMode;
g.currentCommand.clear();
clearCommandMode();
if (g.returnToMode != CommandMode) {
const QString lastInsertion = m_lastInsertion;
if (g.returnToMode == InsertMode)
......@@ -2851,6 +2843,19 @@ void FakeVimHandler::Private::resetCommandMode()
setAnchor();
}
void FakeVimHandler::Private::clearCommandMode()
{
m_submode = NoSubMode;
m_subsubmode = NoSubSubMode;
m_movetype = MoveInclusive;
m_mvcount.clear();
m_opcount.clear();
m_gflag = false;
m_register = '"';
m_rangemode = RangeCharMode;
g.currentCommand.clear();
}
void FakeVimHandler::Private::updateSelection()
{
QList<QTextEdit::ExtraSelection> selections = m_extraSelections;
......@@ -6842,8 +6847,7 @@ void FakeVimHandler::Private::enterCommandMode(Mode returnToMode)
if (atEndOfLine())
moveLeft();
m_mode = CommandMode;
m_submode = NoSubMode;
m_subsubmode = NoSubSubMode;
clearCommandMode();
g.returnToMode = returnToMode;
}
......
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