From da5cdda70d40fb9b9bcb5959c57cf0a67cffd9bf Mon Sep 17 00:00:00 2001
From: mae <qt-info@nokia.com>
Date: Tue, 28 Sep 2010 16:50:02 +0200
Subject: [PATCH] Fixed find scope

There was an off-by-one error for the normal find scope.
Improved look by ignoring the left side.
---
 src/plugins/find/basetextfind.cpp            | 4 ++--
 src/plugins/texteditor/texteditoroverlay.cpp | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/plugins/find/basetextfind.cpp b/src/plugins/find/basetextfind.cpp
index d939c5b69a1..42059de72bc 100644
--- a/src/plugins/find/basetextfind.cpp
+++ b/src/plugins/find/basetextfind.cpp
@@ -329,7 +329,7 @@ void BaseTextFind::defineFindScope()
 {
     QTextCursor cursor = textCursor();
     if (cursor.hasSelection() && cursor.block() != cursor.document()->findBlock(cursor.anchor())) {
-        d->m_findScopeStart = QTextCursor(document()->docHandle(), qMax(0, cursor.selectionStart()-1));
+        d->m_findScopeStart = QTextCursor(document()->docHandle(), qMax(0, cursor.selectionStart()));
         d->m_findScopeEnd = QTextCursor(document()->docHandle(), cursor.selectionEnd());
         d->m_findScopeVerticalBlockSelectionFirstColumn = -1;
         d->m_findScopeVerticalBlockSelectionLastColumn = -1;
@@ -344,7 +344,7 @@ void BaseTextFind::defineFindScope()
         emit findScopeChanged(d->m_findScopeStart, d->m_findScopeEnd,
                               d->m_findScopeVerticalBlockSelectionFirstColumn,
                               d->m_findScopeVerticalBlockSelectionLastColumn);
-        cursor.setPosition(d->m_findScopeStart.position()+1);
+        cursor.setPosition(d->m_findScopeStart.position());
         setTextCursor(cursor);
     } else {
         clearFindScope();
diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp
index 4fbe7d27818..7ee11757cdf 100644
--- a/src/plugins/texteditor/texteditoroverlay.cpp
+++ b/src/plugins/texteditor/texteditoroverlay.cpp
@@ -171,10 +171,10 @@ QPainterPath TextEditorOverlay::createSelectionPath(const QTextCursor &begin, co
                 inSelection = true;
                 firstOrLastBlock = true;
             } else {
-                while (beginChar < block.length() && document->characterAt(block.position() + beginChar).isSpace())
-                    ++beginChar;
-                if (beginChar == block.length())
-                    beginChar = 0;
+//                while (beginChar < block.length() && document->characterAt(block.position() + beginChar).isSpace())
+//                    ++beginChar;
+//                if (beginChar == block.length())
+//                    beginChar = 0;
             }
 
             int lastLine = blockLayout->lineCount()-1;
-- 
GitLab