Put the document into the new state.

def commit(self):
        """
        Put the document into the new state.
        """
        if self.textAfter is None:
            # If this is the first 'commit' call then do not make
            # any changes but store the current document state
            # and its style.
            line, col = self.qteWidget.getNumLinesAndColumns()
            text, style = self.qteWidget.SCIGetStyledText((0, 0, line, col))
            self.styleAfter = style
            self.textAfter = text.decode('utf-8')
        else:
            # Put the document into the 'after' state.
            self.baseClass.setText(self.textAfter)
            self.qteWidget.SCISetStylingEx(0, 0, self.styleAfter)
        self.placeCursor(*self.origPosition)