Fixed an issue in QsciScintillaCompat occurring with QScintilla 2.8 and newer. 5_4_x

Sat, 15 Mar 2014 19:01:43 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 15 Mar 2014 19:01:43 +0100
branch
5_4_x
changeset 3379
dcf9f81f2ae5
parent 3376
64c0145576d0
child 3381
06e6dc2bd0a7

Fixed an issue in QsciScintillaCompat occurring with QScintilla 2.8 and newer.
(grafted from b88e7fd6c009f25db66a5f12964c1bfcc0cf28bc)

QScintilla/QsciScintillaCompat.py file | annotate | diff | comparison | revisions
--- a/QScintilla/QsciScintillaCompat.py	Sat Mar 15 17:24:02 2014 +0100
+++ b/QScintilla/QsciScintillaCompat.py	Sat Mar 15 19:01:43 2014 +0100
@@ -1333,6 +1333,18 @@
             
             return pos
     
+    elif QSCINTILLA_VERSION() >= 0x020800:
+        def positionFromLineIndex(self, line, index):
+            """
+            Public method to convert line and index to an absolute position.
+            
+            @param line line number (integer)
+            @param index index number (integer)
+            @return absolute position in the editor (integer)
+            """
+            pos = self.SendScintilla(QsciScintilla.SCI_POSITIONFROMLINE, line)
+            return pos + index
+    
     if "lineIndexFromPosition" not in QsciScintilla.__dict__:
         def lineIndexFromPosition(self, pos):
             """
@@ -1361,6 +1373,19 @@
             
             return lin, indx
     
+    elif QSCINTILLA_VERSION() >= 0x020800:
+        def lineIndexFromPosition(self, pos):
+            """
+            Public method to convert an absolute position to line and index.
+            
+            @param pos absolute position in the editor (integer)
+            @return tuple of line number (integer) and index number (integer)
+            """
+            lin = self.SendScintilla(QsciScintilla.SCI_LINEFROMPOSITION, pos)
+            linpos = self.SendScintilla(
+                QsciScintilla.SCI_POSITIONFROMLINE, lin)
+            return lin, pos - linpos
+    
     if "contractedFolds" not in QsciScintilla.__dict__:
         def contractedFolds(self):
             """

eric ide

mercurial