def __auto_indent(self, event): text = unicode(self.textCursor().block().previous().text()) spaces = helpers.get_indentation(text) self.textCursor().insertText(spaces) if text != '' and text == ' ' * len(text): self.moveCursor(QTextCursor.Up) self.moveCursor(QTextCursor.EndOfLine, QTextCursor.KeepAnchor) self.textCursor().removeSelectedText() self.moveCursor(QTextCursor.Down) else: helpers.check_for_assistance_completion(self, text)
def __auto_indent(self, event): line, index = self.getCursorPosition() text = self.text(line - 1).strip() symbols_to_look = tuple(settings.BRACES.keys()) + (",", ) if text and text[-1] in symbols_to_look: symbol = " " * self._indent if self.useTabs: symbol = "\t" self.insertAt(symbol, line, index) self.setCursorPosition(line, index + self._indent) if settings.COMPLETE_DECLARATIONS and text and text[-1] == ":": helpers.check_for_assistance_completion(self, text)
def __auto_indent(self, event): line, index = self.getCursorPosition() text = self.text(line - 1).strip() symbols_to_look = tuple(settings.BRACES.keys()) + (",") if text and text[-1] in symbols_to_look: symbol = " " * self._indent if self.useTabs: symbol = "\t" self.insertAt(symbol, line, index) self.setCursorPosition(line, index + self._indent) if settings.COMPLETE_DECLARATIONS and text and text[-1] == ":": helpers.check_for_assistance_completion(self, text)
def __auto_indent(self, event): text = self.textCursor().block().previous().text() spaces = helpers.get_indentation(text, self.indent, self.useTabs) self.textCursor().insertText(spaces) if text != '' and text == ' ' * len(text): self.moveCursor(QTextCursor.Up) self.moveCursor(QTextCursor.EndOfLine, QTextCursor.KeepAnchor) self.textCursor().removeSelectedText() self.moveCursor(QTextCursor.Down) elif settings.COMPLETE_DECLARATIONS: helpers.check_for_assistance_completion(self, text) cursor = self.textCursor() cursor.setPosition(cursor.position()) self.setTextCursor(cursor)
def __auto_indent(self, event): text = unicode(self.textCursor().block().previous().text()) spaces = helpers.get_indentation(text) self.textCursor().insertText(spaces) if text != '' and text == ' ' * len(text): self.moveCursor(QTextCursor.Up) self.moveCursor(QTextCursor.EndOfLine, QTextCursor.KeepAnchor) self.textCursor().removeSelectedText() self.moveCursor(QTextCursor.Down) elif settings.COMPLETE_DECLARATIONS: helpers.check_for_assistance_completion(self, text) cursor = self.textCursor() cursor.setPosition(cursor.position()) self.setTextCursor(cursor)