(self, block, columnIndex, matched)
return selection
Make matched or unmatched QTextEdit.ExtraSelection
Make matched or unmatched QTextEdit.ExtraSelection
Make matched or unmatched QTextEdit . ExtraSelection
def _makeMatchSelection(self, block, columnIndex, matched):
        """Make matched or unmatched QTextEdit.ExtraSelection
        """
        selection = QTextEdit.ExtraSelection()
        darkMode = QApplication.instance().property('darkMode')

        if matched:
            fgColor = self.MATCHED_COLOR
        else:
            fgColor = self.UNMATCHED_COLOR

        selection.format.setForeground(fgColor)
        # repaint hack
        selection.format.setBackground(Qt.white if not darkMode else QColor('#111111'))
        selection.cursor = QTextCursor(block)
        selection.cursor.setPosition(block.position() + columnIndex)
        selection.cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor)

        return selection
def _makeMatchSelection ( self , block , columnIndex , matched ) : selection = QTextEdit . ExtraSelection ( ) darkMode = QApplication . instance ( ) . property ( 'darkMode' ) if matched : fgColor = self . MATCHED_COLOR else : fgColor = self . UNMATCHED_COLOR selection . format . setForeground ( fgColor ) # repaint hack selection . format . setBackground ( Qt . white if not darkMode else QColor ( '#111111' ) ) selection . cursor = QTextCursor ( block ) selection . cursor . setPosition ( block . position ( ) + columnIndex ) selection . cursor . movePosition ( QTextCursor . Right , QTextCursor . KeepAnchor ) return selection