(self, mimeData)
Paste recrangular selection.
        Add space at the beginning of line, if necessary
Paste recrangular selection.
        Add space at the beginning of line, if necessary
Paste recrangular selection . Add space at the beginning of line if necessary
def paste(self, mimeData):
        """Paste recrangular selection.
        Add space at the beginning of line, if necessary
        """
        if self.isActive():
            self.delete()
        elif self._qpart.textCursor().hasSelection():
            self._qpart.textCursor().deleteChar()

        text = bytes(mimeData.data(self.MIME_TYPE)).decode('utf8')
        lines = text.splitlines()
        cursorLine, cursorCol = self._qpart.cursorPosition
        if cursorLine + len(lines) > len(self._qpart.lines):
            for _ in range(cursorLine + len(lines) - len(self._qpart.lines)):
                self._qpart.lines.append('')

        with self._qpart:
            for index, line in enumerate(lines):
                currentLine = self._qpart.lines[cursorLine + index]
                newLine = currentLine[:cursorCol] + \
                          self._indentUpTo(currentLine, cursorCol) + \
                          line + \
                          currentLine[cursorCol:]
                self._qpart.lines[cursorLine + index] = newLine
        self._qpart.cursorPosition = cursorLine, cursorCol
def paste ( self , mimeData ) : if self . isActive ( ) : self . delete ( ) elif self . _qpart . textCursor ( ) . hasSelection ( ) : self . _qpart . textCursor ( ) . deleteChar ( ) text = bytes ( mimeData . data ( self . MIME_TYPE ) ) . decode ( 'utf8' ) lines = text . splitlines ( ) cursorLine , cursorCol = self . _qpart . cursorPosition if cursorLine + len ( lines ) > len ( self . _qpart . lines ) : for _ in range ( cursorLine + len ( lines ) - len ( self . _qpart . lines ) ) : self . _qpart . lines . append ( '' ) with self . _qpart : for index , line in enumerate ( lines ) : currentLine = self . _qpart . lines [ cursorLine + index ] newLine = currentLine [ : cursorCol ] + self . _indentUpTo ( currentLine , cursorCol ) + line + currentLine [ cursorCol : ] self . _qpart . lines [ cursorLine + index ] = newLine self . _qpart . cursorPosition = cursorLine , cursorCol