Sat, 15 Mar 2014 19:01:43 +0100
Fixed an issue in QsciScintillaCompat occurring with QScintilla 2.8 and newer.
Documentation/Help/source.qch | file | annotate | diff | comparison | revisions | |
QScintilla/QsciScintillaCompat.py | file | annotate | diff | comparison | revisions |
--- a/QScintilla/QsciScintillaCompat.py Sat Mar 15 17:35:04 2014 +0100 +++ b/QScintilla/QsciScintillaCompat.py Sat Mar 15 19:01:43 2014 +0100 @@ -1336,6 +1336,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): """ @@ -1364,6 +1376,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): """