docs: def commit(self):
          """
          Delete the rest of the line.
          """
  
          # Get the text cursor for the current document and unselect
          # everything.
          tc = self.qteWidget.textCursor()
          tc.clearSelection()
  
          # If this is the first ever call to this undo/redo element then
          # backup the current cursor position and the selected text (may be
          # none). This information will be required for the redo operation
          # to position the cursor (and selected text) where it was at the
          # very first call.
          if self.cursorPos0 is None:
              self.cursorPos0 = tc.position()
          else:
              tc.setPosition(self.cursorPos0, QtGui.QTextCursor.MoveAnchor)
  
          # Insert the element and keep track of how much the cursor has
          # moved. This is trivial to determine automatically if
          # `yankText` is pure text, but if it is HTML code then it is
          # safer to rely on Qt's builtin ``position`` method.
          if self.textType:
              tc.insertText(self.yankText)
          else:
              tc.insertHtml(self.yankText)
          self.cursorPos1 = tc.position()
  
          # Apply the changes.
          self.qteWidget.setTextCursor(tc)