code: def cursorPositionChangedEvent(self):
          qteWidget = self.sender()
          tc = qteWidget.textCursor()
          origin = tc.position()
          qteWidget.cursorPositionChanged.disconnect(
              self.cursorPositionChangedEvent)
          self.qteRemoveHighlighting(qteWidget)
          qteWidget.cursorPositionChanged.connect(
              self.cursorPositionChangedEvent)
          if origin >= len(qteWidget.toPlainText()):
              return
          else:
              char = qteWidget.toPlainText()[origin]
          if char not in self.charToHighlight:
              return
          qteWidget.cursorPositionChanged.disconnect(
              self.cursorPositionChangedEvent)
          if char == self.charToHighlight[0]:
              start = origin
              stop = qteWidget.toPlainText().find(self.charToHighlight[1],
                                                  start + 1)
          else:
              stop = origin
              start = qteWidget.toPlainText().rfind(self.charToHighlight[0],
                                                    0, stop)
          oldCharFormats = self.highlightCharacters(qteWidget, (start, stop),
                                                    QtCore.Qt.blue, 100)
          data = self.qteMacroData(qteWidget)
          data.matchingPositions = (start, stop)
          data.oldCharFormats = oldCharFormats
          self.qteSaveMacroData(data, qteWidget)
          qteWidget.cursorPositionChanged.connect(
              self.cursorPositionChangedEvent)