diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 39697b68fe885d3e45d9580fb2efff4d5c6ba488..d14b44336795ddda154d8ed2a97637d26d00f087 100755 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -347,7 +347,7 @@ public: m_targetColumn = leftDist(); //qDebug() << "TARGET: " << m_targetColumn; } - void moveToNextWord(bool simple); + void moveToNextWord(bool simple, bool deleteWord = false); void moveToMatchingParanthesis(); void moveToWordBoundary(bool simple, bool forward, bool changeWord = false); @@ -1701,7 +1701,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified, moveToWordBoundary(false, true, true); m_movetype = MoveInclusive; } else { - moveToNextWord(false); + moveToNextWord(false, m_submode==DeleteSubMode); m_movetype = MoveExclusive; } finishMovement("%1w", count()); @@ -1710,7 +1710,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified, moveToWordBoundary(true, true, true); m_movetype = MoveInclusive; } else { - moveToNextWord(true); + moveToNextWord(true, m_submode==DeleteSubMode); m_movetype = MoveExclusive; } finishMovement("%1W", count()); @@ -2743,7 +2743,7 @@ void FakeVimHandler::Private::handleFfTt(int key) setTargetColumn(); } -void FakeVimHandler::Private::moveToNextWord(bool simple) +void FakeVimHandler::Private::moveToNextWord(bool simple, bool deleteWord) { int repeat = count(); int n = lastPositionInDocument(); @@ -2757,8 +2757,13 @@ void FakeVimHandler::Private::moveToNextWord(bool simple) break; lastClass = thisClass; moveRight(); - if (m_tc.block().length() == 1) // empty line - --repeat; + if (deleteWord) { + if (m_tc.atBlockEnd()) + --repeat; + } else { + if (m_tc.block().length() == 1) // empty line + --repeat; + } if (repeat == 0) break; if (m_tc.position() == n) diff --git a/tests/auto/fakevim/main.cpp b/tests/auto/fakevim/main.cpp index fab7e973d768d0585a767e63eb7ee5afbae56bd9..2815ad86cb767ef3fe1b61cc8db3d9cfe210beaf 100644 --- a/tests/auto/fakevim/main.cpp +++ b/tests/auto/fakevim/main.cpp @@ -439,8 +439,7 @@ void tst_FakeVim::command_dw() check("dw", "@<QtCore>\n" + lmid(2)); check("dw", "@QtCore>\n" + lmid(2)); check("dw", "@>\n" + lmid(2)); - qWarning("FIXME"); - //check("dw", "@\n" + lmid(2)); // FIXME: Real vim has this intermediate step + check("dw", "@\n" + lmid(2)); // Real vim has this intermediate step, too check("dw", "@#include <QtGui>\n" + lmid(3)); check("dw", "@include <QtGui>\n" + lmid(3)); check("dw", "@<QtGui>\n" + lmid(3));