Skip to content
Snippets Groups Projects
Commit b919dbe5 authored by hjk's avatar hjk
Browse files

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

parent dc472570
Branches
Tags
No related merge requests found
...@@ -253,7 +253,10 @@ public: ...@@ -253,7 +253,10 @@ public:
void moveToFirstNonBlankOnLine(); void moveToFirstNonBlankOnLine();
void moveToTargetColumn(); void moveToTargetColumn();
void setTargetColumn() { m_targetColumn = leftDist(); } void setTargetColumn() {
m_targetColumn = leftDist();
//qDebug() << "TARGET: " << m_targetColumn;
}
void moveToNextWord(bool simple); void moveToNextWord(bool simple);
void moveToMatchingParanthesis(); void moveToMatchingParanthesis();
void moveToWordBoundary(bool simple, bool forward); void moveToWordBoundary(bool simple, bool forward);
...@@ -672,6 +675,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand) ...@@ -672,6 +675,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
m_submode = NoSubMode; m_submode = NoSubMode;
if (atEndOfLine()) if (atEndOfLine())
moveLeft(); moveLeft();
else
setTargetColumn();
} else if (m_submode == YankSubMode) { } else if (m_submode == YankSubMode) {
m_registers[m_register] = selectedText(); m_registers[m_register] = selectedText();
setPosition(m_savedYankPosition); setPosition(m_savedYankPosition);
...@@ -2507,9 +2512,12 @@ void FakeVimHandler::Private::replay(const QString &command, int n) ...@@ -2507,9 +2512,12 @@ void FakeVimHandler::Private::replay(const QString &command, int n)
{ {
//qDebug() << "REPLAY: " << command; //qDebug() << "REPLAY: " << command;
m_inReplay = true; m_inReplay = true;
for (int i = n; --i >= 0; ) for (int i = n; --i >= 0; ) {
foreach (QChar c, command) foreach (QChar c, command) {
//qDebug() << " REPLAY: " << QString(c);
handleKey(c.unicode(), c.unicode(), QString(c)); handleKey(c.unicode(), c.unicode(), QString(c));
}
}
m_inReplay = false; m_inReplay = false;
} }
......
...@@ -60,6 +60,7 @@ private slots: ...@@ -60,6 +60,7 @@ private slots:
void command_dd(); void command_dd();
void command_dollar(); void command_dollar();
void command_down(); void command_down();
void command_dfx_down();
void command_e(); void command_e();
void command_i(); void command_i();
void command_left(); void command_left();
...@@ -296,6 +297,18 @@ void tst_FakeVim::command_down() ...@@ -296,6 +297,18 @@ void tst_FakeVim::command_down()
move("4j", "@ return app.exec()"); 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() void tst_FakeVim::command_e()
{ {
setup(); setup();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment