def indent_selection(self, cursor):
doc = self.editor.document()<EOL>tab_len = self.editor.tab_length<EOL>cursor.beginEditBlock()<EOL>nb_lines = len(cursor.selection().toPlainText().splitlines())<EOL>if (cursor.atBlockStart() and cursor.position() == cursor.selectionEnd()):<EOL><INDENT>nb_lines += <NUM_LIT:1><EOL><DEDENT>block = doc.findBlock(cursor.selectionStart())<EOL>i = <NUM_LIT:0><EOL>while i < nb_lines:<EOL><INDENT>nb_space_to_add = tab_len<EOL>cursor = QtGui.QTextCursor(block)<EOL>cursor.movePosition(cursor.StartOfLine, cursor.MoveAnchor)<EOL>cursor.movePosition(cursor.Right, cursor.MoveAnchor, self.min_column)<EOL>if self.editor.use_spaces_instead_of_tabs:<EOL><INDENT>for _ in range(nb_space_to_add):<EOL><INDENT>cursor.insertText("<STR_LIT:U+0020>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>cursor.insertText('<STR_LIT:\t>')<EOL><DEDENT>block = block.next()<EOL>i += <NUM_LIT:1><EOL><DEDENT>cursor.endEditBlock()<EOL>
Indent selected text

:param cursor: QTextCursor