QScintilla/QsciScintillaCompat.py

changeset 2658
ec17f5d559e9
parent 2653
94ff2db166f5
child 2659
7f46c5a7ed73
equal deleted inserted replaced
2657:eb87b82eca17 2658:ec17f5d559e9
522 startPos = self.positionFromLineIndex(startLine, startIndex) 522 startPos = self.positionFromLineIndex(startLine, startIndex)
523 endPos = self.positionFromLineIndex(endLine, endIndex) 523 endPos = self.positionFromLineIndex(endLine, endIndex)
524 524
525 self.SendScintilla(QsciScintilla.SCI_SETRECTANGULARSELECTIONANCHOR, startPos) 525 self.SendScintilla(QsciScintilla.SCI_SETRECTANGULARSELECTIONANCHOR, startPos)
526 self.SendScintilla(QsciScintilla.SCI_SETRECTANGULARSELECTIONCARET, endPos) 526 self.SendScintilla(QsciScintilla.SCI_SETRECTANGULARSELECTIONCARET, endPos)
527
528 def getSelectionCount(self):
529 """
530 Public method to get the number of active selections.
531
532 @return number of active selection (integer)
533 """
534 return self.SendScintilla(QsciScintilla.SCI_GETSELECTIONS)
535
536 def getSelectionN(self, index):
537 """
538 Public method to get the start and end of a selection given by it's index.
539
540 @return tuple with start line and index and end line and index
541 (tuple of four int) for the given selection
542 """
543 startPos = self.SendScintilla(QsciScintilla.SCI_GETSELECTIONNSTART, index)
544 endPos = self.SendScintilla(QsciScintilla.SCI_GETSELECTIONNEND, index)
545 startLine, startIndex = self.lineIndexFromPosition(startPos)
546 endLine, endIndex = self.lineIndexFromPosition(endPos)
547
548 return (startLine, startIndex, endLine, endIndex)
549
550 def getSelections(self):
551 """
552 Public method to get the start and end coordinates of all active selections.
553
554 @return list of tuples with start line and index and end line and index
555 of each active selection (list of tuples of four int)
556 """
557 selections = []
558 for index in range(self.getSelectionCount()):
559 selections.append(self.getSelectionN(index))
560 return selections
527 561
528 def getLineSeparator(self): 562 def getLineSeparator(self):
529 """ 563 """
530 Public method to get the line separator for the current eol mode. 564 Public method to get the line separator for the current eol mode.
531 565

eric ide

mercurial