Commit b919dbe5 authored by hjk's avatar hjk

fakevim: fix cursor column positioning bug after cfx + <Down>

parent dc472570
......@@ -253,7 +253,10 @@ public:
void moveToFirstNonBlankOnLine();
void moveToTargetColumn();
void setTargetColumn() { m_targetColumn = leftDist(); }
void setTargetColumn() {
m_targetColumn = leftDist();
//qDebug() << "TARGET: " << m_targetColumn;
}
void moveToNextWord(bool simple);
void moveToMatchingParanthesis();
void moveToWordBoundary(bool simple, bool forward);
......@@ -672,6 +675,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
m_submode = NoSubMode;
if (atEndOfLine())
moveLeft();
else
setTargetColumn();
} else if (m_submode == YankSubMode) {
m_registers[m_register] = selectedText();
setPosition(m_savedYankPosition);
......@@ -2507,9 +2512,12 @@ void FakeVimHandler::Private::replay(const QString &command, int n)
{
//qDebug() << "REPLAY: " << command;
m_inReplay = true;
for (int i = n; --i >= 0; )
foreach (QChar c, command)
for (int i = n; --i >= 0; ) {
foreach (QChar c, command) {
//qDebug() << " REPLAY: " << QString(c);
handleKey(c.unicode(), c.unicode(), QString(c));
}
}
m_inReplay = false;
}
......
......@@ -60,6 +60,7 @@ private slots:
void command_dd();
void command_dollar();
void command_down();
void command_dfx_down();
void command_e();
void command_i();
void command_left();
......@@ -296,6 +297,18 @@ void tst_FakeVim::command_down()
move("4j", "@ return app.exec()");
}
void tst_FakeVim::command_dfx_down()
{
setup();
check("j4l", l[0] + "\n#inc@lude <QtCore>\n" + lmid(2));
check("df ", l[0] + "\n#inc@<QtCore>\n" + lmid(2));
check("j", l[0] + "\n#inc<QtCore>\n#inc@lude <QtGui>\n" + lmid(3));
check(".", l[0] + "\n#inc<QtCore>\n#inc@<QtGui>\n" + lmid(3));
return;
check("u", l[0] + "\n#inc<QtCore>\n#inc@lude <QtGui>\n" + lmid(3));
check("u", l[0] + "\n#inc@lude <QtCore>\n" + lmid(2));
}
void tst_FakeVim::command_e()
{
setup();
......
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