From c9bddb70cb4804672cedb23dbfb3ca13724f0e68 Mon Sep 17 00:00:00 2001
From: Kent Hansen <khansen@trolltech.com>
Date: Fri, 12 Jun 2009 15:25:38 +0200
Subject: fix bugs in the completion+tooltip providers

---
 src/scripttools/debugging/qscriptcompletiontask.cpp   | 2 +-
 src/scripttools/debugging/qscriptdebuggercodeview.cpp | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/scripttools/debugging/qscriptcompletiontask.cpp b/src/scripttools/debugging/qscriptcompletiontask.cpp
index 2f3c2cf..9554681 100644
--- a/src/scripttools/debugging/qscriptcompletiontask.cpp
+++ b/src/scripttools/debugging/qscriptcompletiontask.cpp
@@ -132,7 +132,7 @@ void QScriptCompletionTaskPrivate::completeScriptExpression()
 
     while ((pos > 0) && isIdentChar(contents.at(pos-1)))
         --pos;
-    int pos2 = cursorPosition;
+    int pos2 = cursorPosition - 1;
     while ((pos2 < contents.size()-1) && isIdentChar(contents.at(pos2+1)))
         ++pos2;
     QString ident = contents.mid(pos, pos2 - pos + 1);
diff --git a/src/scripttools/debugging/qscriptdebuggercodeview.cpp b/src/scripttools/debugging/qscriptdebuggercodeview.cpp
index bc493e0..c03ec83 100644
--- a/src/scripttools/debugging/qscriptdebuggercodeview.cpp
+++ b/src/scripttools/debugging/qscriptdebuggercodeview.cpp
@@ -214,7 +214,6 @@ bool QScriptDebuggerCodeView::event(QEvent *e)
         if (contents.isEmpty())
             return false;
         int linePosition = cursor.position() - block.position();
-        linePosition -= 3;
         if (linePosition < 0)
             linePosition = 0;
 
@@ -233,7 +232,7 @@ bool QScriptDebuggerCodeView::event(QEvent *e)
             // ignore string literals
             return false;
         }
-        int pos2 = linePosition;
+        int pos2 = linePosition - 1;
         while ((pos2 < contents.size()-1) && isIdentChar(contents.at(pos2+1)))
             ++pos2;
         QString ident = contents.mid(pos, pos2 - pos + 1);
-- 
cgit v0.12