1334 for i in range(index): |
1334 for i in range(index): |
1335 pos = self.positionAfter(pos) |
1335 pos = self.positionAfter(pos) |
1336 |
1336 |
1337 return pos |
1337 return pos |
1338 |
1338 |
|
1339 elif QSCINTILLA_VERSION() >= 0x020800: |
|
1340 def positionFromLineIndex(self, line, index): |
|
1341 """ |
|
1342 Public method to convert line and index to an absolute position. |
|
1343 |
|
1344 @param line line number (integer) |
|
1345 @param index index number (integer) |
|
1346 @return absolute position in the editor (integer) |
|
1347 """ |
|
1348 pos = self.SendScintilla(QsciScintilla.SCI_POSITIONFROMLINE, line) |
|
1349 return pos + index |
|
1350 |
1339 if "lineIndexFromPosition" not in QsciScintilla.__dict__: |
1351 if "lineIndexFromPosition" not in QsciScintilla.__dict__: |
1340 def lineIndexFromPosition(self, pos): |
1352 def lineIndexFromPosition(self, pos): |
1341 """ |
1353 """ |
1342 Public method to convert an absolute position to line and index. |
1354 Public method to convert an absolute position to line and index. |
1343 |
1355 |
1361 |
1373 |
1362 linpos = new_linpos |
1374 linpos = new_linpos |
1363 indx += 1 |
1375 indx += 1 |
1364 |
1376 |
1365 return lin, indx |
1377 return lin, indx |
|
1378 |
|
1379 elif QSCINTILLA_VERSION() >= 0x020800: |
|
1380 def lineIndexFromPosition(self, pos): |
|
1381 """ |
|
1382 Public method to convert an absolute position to line and index. |
|
1383 |
|
1384 @param pos absolute position in the editor (integer) |
|
1385 @return tuple of line number (integer) and index number (integer) |
|
1386 """ |
|
1387 lin = self.SendScintilla(QsciScintilla.SCI_LINEFROMPOSITION, pos) |
|
1388 linpos = self.SendScintilla( |
|
1389 QsciScintilla.SCI_POSITIONFROMLINE, lin) |
|
1390 return lin, pos - linpos |
1366 |
1391 |
1367 if "contractedFolds" not in QsciScintilla.__dict__: |
1392 if "contractedFolds" not in QsciScintilla.__dict__: |
1368 def contractedFolds(self): |
1393 def contractedFolds(self): |
1369 """ |
1394 """ |
1370 Public method to get a list of line numbers of collapsed folds. |
1395 Public method to get a list of line numbers of collapsed folds. |