From d323d7701e48a5561c42b1d0a3231f2d9a4fe75f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Aum=C3=BCller?= <aumuell@reserv.at>
Date: Thu, 21 Jan 2010 17:38:26 +0100
Subject: [PATCH] fakevim: make 'w' stop on empty lines

Merge-request: 99
Reviewed-by: hjk <qtc-committer@nokia.com>
---
 src/plugins/fakevim/fakevimhandler.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index 0ed3706384b..7e44f200638 100755
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -2750,7 +2750,6 @@ void FakeVimHandler::Private::handleFfTt(int key)
 
 void FakeVimHandler::Private::moveToNextWord(bool simple)
 {
-    // FIXME: 'w' should stop on empty lines, too
     int repeat = count();
     int n = lastPositionInDocument();
     int lastClass = charClass(characterAtCursor(), simple);
@@ -2763,6 +2762,10 @@ void FakeVimHandler::Private::moveToNextWord(bool simple)
             break;
         lastClass = thisClass;
         moveRight();
+        if (m_tc.block().length() == 1) // empty line
+            --repeat;
+        if (repeat == 0)
+            break;
         if (m_tc.position() == n)
             break;
     }
-- 
GitLab