def unindent_selection(self, cursor):
doc = self.editor.document()<EOL>tab_len = self.editor.tab_length<EOL>nb_lines = len(cursor.selection().toPlainText().splitlines())<EOL>if nb_lines == <NUM_LIT:0>:<EOL><INDENT>nb_lines = <NUM_LIT:1><EOL><DEDENT>block = doc.findBlock(cursor.selectionStart())<EOL>assert isinstance(block, QtGui.QTextBlock)<EOL>i = <NUM_LIT:0><EOL>_logger().debug('<STR_LIT>', nb_lines)<EOL>while i < nb_lines:<EOL><INDENT>txt = block.text()[self.min_column:]<EOL>_logger().debug('<STR_LIT>', txt)<EOL>_logger().debug('<STR_LIT>',<EOL>self.editor.use_spaces_instead_of_tabs)<EOL>if self.editor.use_spaces_instead_of_tabs:<EOL><INDENT>indentation = len(txt) - len(txt.lstrip())<EOL><DEDENT>else:<EOL><INDENT>indentation = len(txt) - len(txt.replace('<STR_LIT:\t>', '<STR_LIT>'))<EOL><DEDENT>_logger().debug('<STR_LIT>', i, indentation, self.min_column)<EOL>if indentation > <NUM_LIT:0>:<EOL><INDENT>c = QtGui.QTextCursor(block)<EOL>c.movePosition(c.StartOfLine, cursor.MoveAnchor)<EOL>c.movePosition(c.Right, cursor.MoveAnchor, indentation + self.min_column)<EOL>max_spaces = indentation % tab_len<EOL>if max_spaces == <NUM_LIT:0>:<EOL><INDENT>max_spaces = tab_len<EOL><DEDENT>spaces = self.count_deletable_spaces(c, max_spaces)<EOL>for _ in range(spaces):<EOL><INDENT>c.deletePreviousChar()<EOL><DEDENT><DEDENT>block = block.next()<EOL>i += <NUM_LIT:1><EOL><DEDENT>return cursor<EOL>
Un-indents selected text

:param cursor: QTextCursor