diff -r 0a02c433f52d -r 5883ce99ee12 QScintilla/TypingCompleters/CompleterPython.py --- a/QScintilla/TypingCompleters/CompleterPython.py Fri Nov 01 15:48:48 2013 +0100 +++ b/QScintilla/TypingCompleters/CompleterPython.py Sun Nov 03 15:58:22 2013 +0100 @@ -238,7 +238,7 @@ edInd = self.editor.indentation(ifLine) if self.__elseRX.indexIn(txt) == 0 and edInd <= indentation: indentation = edInd - 1 - elif (self.__ifRX.indexIn(txt) == 0 or \ + elif (self.__ifRX.indexIn(txt) == 0 or self.__elifRX.indexIn(txt) == 0) and edInd <= indentation: self.editor.cancelList() self.editor.setIndentation(line, edInd) @@ -261,14 +261,14 @@ if self.__elseRX.indexIn(txt) == 0 and edInd <= indentation: indentation = edInd - 1 elif self.__elifRX.indexIn(txt) == 0 and \ - edInd == indentation and \ - edInd == prevInd: - indentation = edInd - 1 - elif (self.__ifRX.indexIn(txt) == 0 or \ - self.__whileRX.indexIn(txt) == 0 or \ - self.__forRX.indexIn(txt) == 0 or \ + edInd == indentation and \ + edInd == prevInd: + indentation = edInd - 1 + elif (self.__ifRX.indexIn(txt) == 0 or + self.__whileRX.indexIn(txt) == 0 or + self.__forRX.indexIn(txt) == 0 or self.__tryRX.indexIn(txt) == 0) and \ - edInd <= indentation: + edInd <= indentation: self.editor.cancelList() self.editor.setIndentation(line, edInd) break @@ -287,10 +287,11 @@ while tryLine >= 0: txt = self.editor.text(tryLine) edInd = self.editor.indentation(tryLine) - if (self.__exceptcRX.indexIn(txt) == 0 or \ - self.__finallyRX.indexIn(txt) == 0) and edInd <= indentation: + if (self.__exceptcRX.indexIn(txt) == 0 or + self.__finallyRX.indexIn(txt) == 0) and \ + edInd <= indentation: indentation = edInd - 1 - elif (self.__exceptRX.indexIn(txt) == 0 or \ + elif (self.__exceptRX.indexIn(txt) == 0 or self.__tryRX.indexIn(txt) == 0) and edInd <= indentation: self.editor.cancelList() self.editor.setIndentation(line, edInd) @@ -309,8 +310,8 @@ txt = self.editor.text(tryLine) edInd = self.editor.indentation(tryLine) if self.__py24StyleTry: - if (self.__exceptcRX.indexIn(txt) == 0 or \ - self.__exceptRX.indexIn(txt) == 0 or \ + if (self.__exceptcRX.indexIn(txt) == 0 or + self.__exceptRX.indexIn(txt) == 0 or self.__finallyRX.indexIn(txt) == 0) and \ edInd <= indentation: indentation = edInd - 1 @@ -321,8 +322,8 @@ else: if self.__finallyRX.indexIn(txt) == 0 and edInd <= indentation: indentation = edInd - 1 - elif (self.__tryRX.indexIn(txt) == 0 or \ - self.__exceptcRX.indexIn(txt) == 0 or \ + elif (self.__tryRX.indexIn(txt) == 0 or + self.__exceptcRX.indexIn(txt) == 0 or self.__exceptRX.indexIn(txt) == 0) and \ edInd <= indentation: self.editor.cancelList() @@ -364,15 +365,15 @@ curLine = line - 1 while curLine >= 0: txt = self.editor.text(curLine) - if (self.__defSelfRX.indexIn(txt) == 0 or \ + if (self.__defSelfRX.indexIn(txt) == 0 or self.__defClsRX.indexIn(txt) == 0) and \ self.editor.indentation(curLine) == indentation: return True elif self.__classRX.indexIn(txt) == 0 and \ - self.editor.indentation(curLine) < indentation: + self.editor.indentation(curLine) < indentation: return True elif self.__defRX.indexIn(txt) == 0 and \ - self.editor.indentation(curLine) <= indentation: + self.editor.indentation(curLine) <= indentation: return False curLine -= 1 return False