QScintilla/QsciScintillaCompat.py

branch
5_4_x
changeset 3379
dcf9f81f2ae5
parent 3258
a2bec950a859
child 3391
30c8ac760fed
equal deleted inserted replaced
3376:64c0145576d0 3379:dcf9f81f2ae5
1331 for i in range(index): 1331 for i in range(index):
1332 pos = self.positionAfter(pos) 1332 pos = self.positionAfter(pos)
1333 1333
1334 return pos 1334 return pos
1335 1335
1336 elif QSCINTILLA_VERSION() >= 0x020800:
1337 def positionFromLineIndex(self, line, index):
1338 """
1339 Public method to convert line and index to an absolute position.
1340
1341 @param line line number (integer)
1342 @param index index number (integer)
1343 @return absolute position in the editor (integer)
1344 """
1345 pos = self.SendScintilla(QsciScintilla.SCI_POSITIONFROMLINE, line)
1346 return pos + index
1347
1336 if "lineIndexFromPosition" not in QsciScintilla.__dict__: 1348 if "lineIndexFromPosition" not in QsciScintilla.__dict__:
1337 def lineIndexFromPosition(self, pos): 1349 def lineIndexFromPosition(self, pos):
1338 """ 1350 """
1339 Public method to convert an absolute position to line and index. 1351 Public method to convert an absolute position to line and index.
1340 1352
1358 1370
1359 linpos = new_linpos 1371 linpos = new_linpos
1360 indx += 1 1372 indx += 1
1361 1373
1362 return lin, indx 1374 return lin, indx
1375
1376 elif QSCINTILLA_VERSION() >= 0x020800:
1377 def lineIndexFromPosition(self, pos):
1378 """
1379 Public method to convert an absolute position to line and index.
1380
1381 @param pos absolute position in the editor (integer)
1382 @return tuple of line number (integer) and index number (integer)
1383 """
1384 lin = self.SendScintilla(QsciScintilla.SCI_LINEFROMPOSITION, pos)
1385 linpos = self.SendScintilla(
1386 QsciScintilla.SCI_POSITIONFROMLINE, lin)
1387 return lin, pos - linpos
1363 1388
1364 if "contractedFolds" not in QsciScintilla.__dict__: 1389 if "contractedFolds" not in QsciScintilla.__dict__:
1365 def contractedFolds(self): 1390 def contractedFolds(self):
1366 """ 1391 """
1367 Public method to get a list of line numbers of collapsed folds. 1392 Public method to get a list of line numbers of collapsed folds.

eric ide

mercurial