Little improvement to the editor assembly.

Wed, 13 Jun 2012 19:27:35 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Jun 2012 19:27:35 +0200
changeset 1897
4c89af5a756f
parent 1894
a7096cf751db
child 1898
8cc59791d781

Little improvement to the editor assembly.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Source/eric5.QScintilla.Editor.html file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
QScintilla/EditorAssembly.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Tue Jun 12 19:01:14 2012 +0200
+++ b/APIs/Python3/eric5.api	Wed Jun 13 19:27:35 2012 +0200
@@ -5884,7 +5884,7 @@
 eric5.QScintilla.Editor.Editor.getWordLeft?4(line, index)
 eric5.QScintilla.Editor.Editor.getWordRight?4(line, index)
 eric5.QScintilla.Editor.Editor.gotoLastEditPosition?4()
-eric5.QScintilla.Editor.Editor.gotoLine?4(line, pos=1)
+eric5.QScintilla.Editor.Editor.gotoLine?4(line, pos=1, firstVisible=False)
 eric5.QScintilla.Editor.Editor.gotoMethodClass?4(goUp=False)
 eric5.QScintilla.Editor.Editor.gotoSyntaxError?4()
 eric5.QScintilla.Editor.Editor.handleMonospacedEnable?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Source/eric5.QScintilla.Editor.html	Tue Jun 12 19:01:14 2012 +0200
+++ b/Documentation/Source/eric5.QScintilla.Editor.html	Wed Jun 13 19:27:35 2012 +0200
@@ -2729,7 +2729,7 @@
         Public method to move the cursor to the last edit position.
 </p><a NAME="Editor.gotoLine" ID="Editor.gotoLine"></a>
 <h4>Editor.gotoLine</h4>
-<b>gotoLine</b>(<i>line, pos=1</i>)
+<b>gotoLine</b>(<i>line, pos=1, firstVisible=False</i>)
 <p>
         Public slot to jump to the beginning of a line.
 </p><dl>
@@ -2739,6 +2739,10 @@
 </dd><dt><i>pos=</i></dt>
 <dd>
 position in line to go to (integer)
+</dd><dt><i>firstVisible=</i></dt>
+<dd>
+flag indicating to make the line the first
+            visible line (boolean)
 </dd>
 </dl><a NAME="Editor.gotoMethodClass" ID="Editor.gotoMethodClass"></a>
 <h4>Editor.gotoMethodClass</h4>
--- a/QScintilla/Editor.py	Tue Jun 12 19:01:14 2012 +0200
+++ b/QScintilla/Editor.py	Wed Jun 13 19:27:35 2012 +0200
@@ -2697,9 +2697,7 @@
         
         @param line line number to make visible
         """
-        topLine = self.firstVisibleLine()
-        linesToScroll = line - topLine
-        self.scrollVertical(linesToScroll)
+        self.setFirstVisibleLine(line - 1)
         
     def __marginClicked(self, margin, line, modifiers):
         """
@@ -3335,15 +3333,20 @@
             else:
                 self.__indentLine(True)
         
-    def gotoLine(self, line, pos=1):
+    def gotoLine(self, line, pos=1, firstVisible=False):
         """
         Public slot to jump to the beginning of a line.
         
         @param line line number to go to (integer)
         @keyparam pos position in line to go to (integer)
+        @keyparam firstVisible flag indicating to make the line the first
+            visible line (boolean)
         """
         self.setCursorPosition(line - 1, pos - 1)
-        self.ensureVisible(line)
+        if firstVisible:
+            self.ensureVisibleTop(line)
+        else:
+            self.ensureVisible(line)
     
     def __textChanged(self):
         """
--- a/QScintilla/EditorAssembly.py	Tue Jun 12 19:01:14 2012 +0200
+++ b/QScintilla/EditorAssembly.py	Wed Jun 13 19:27:35 2012 +0200
@@ -97,7 +97,7 @@
             if moveCursor:
                 txt = self.__editor.text(lineno - 1).rstrip()
                 pos = len(txt.replace(txt.strip(), ""))
-                self.__editor.gotoLine(lineno, pos if pos == 0 else pos + 1)
+                self.__editor.gotoLine(lineno, pos if pos == 0 else pos + 1, True)
                 self.__editor.setFocus()
             
             # step 2: populate the members combo, if the entry is a class
@@ -176,7 +176,7 @@
         if lineno is not None and moveCursor:
             txt = self.__editor.text(lineno - 1).rstrip()
             pos = len(txt.replace(txt.strip(), ""))
-            self.__editor.gotoLine(lineno, pos if pos == 0 else pos + 1)
+            self.__editor.gotoLine(lineno, pos if pos == 0 else pos + 1, True)
             self.__editor.setFocus()
     
     def __resetParseTimer(self):

eric ide

mercurial