From b0991bd22c607d725777b816d95ba5e554a32944 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:25 +0100
Subject: [PATCH] fakevim: fix moving to first non-blank on a line

if there are only blanks, first non-blank on line is the last position

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

diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index 563c06354c4..3b500403634 100755
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -2472,7 +2472,7 @@ void FakeVimHandler::Private::moveToFirstNonBlankOnLine()
     const QTextBlock &block = m_tc.block();
     int firstPos = block.position();
     for (int i = firstPos, n = firstPos + block.length(); i < n; ++i) {
-        if (!doc->characterAt(i).isSpace()) {
+        if (!doc->characterAt(i).isSpace() || i == n - 1) {
             setPosition(i);
             return;
         }
-- 
GitLab