<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unindent(self):
 """ Unindents the document text under cursor. :return: Method success. :rtype: bool """


        cursor = self.textCursor()
        if not cursor.hasSelection():
            cursor.movePosition(QTextCursor.StartOfBlock)
            line = foundations.strings.to_string(self.document().findBlockByNumber(cursor.blockNumber()).text())
            indent_marker = re.match(r"({0})".format(self.__indent_marker), line)
            if indent_marker:
                foundations.common.repeat(cursor.deleteChar, len(indent_marker.group(1)))
        else:
            block = self.document().findBlock(cursor.selectionStart())
            while True:
                block_cursor = self.textCursor()
                block_cursor.setPosition(block.position())
                indent_marker = re.match(r"({0})".format(self.__indent_marker), block.text())
                if indent_marker:
                    foundations.common.repeat(block_cursor.deleteChar, len(indent_marker.group(1)))
                if block.contains(cursor.selectionEnd()):
                    break
                block = block.next()
        return True