diff -r 349308e84eeb -r 772103b14c18 eric6/QScintilla/TypingCompleters/CompleterPython.py --- a/eric6/QScintilla/TypingCompleters/CompleterPython.py Mon Apr 12 19:05:23 2021 +0200 +++ b/eric6/QScintilla/TypingCompleters/CompleterPython.py Mon Apr 12 19:21:40 2021 +0200 @@ -277,12 +277,12 @@ while ifLine >= 0: txt = self.editor.text(ifLine) edInd = self.editor.indentation(ifLine) - if rxIndex(self.__elseRX, txt) == 0 and edInd <= indentation: - indentation = edInd - 1 - elif ( - rxIndex(self.__elifRX, txt) == 0 and - edInd == indentation and - edInd == prevInd + if ( + (rxIndex(self.__elseRX, txt) == 0 and + edInd <= indentation) or + (rxIndex(self.__elifRX, txt) == 0 and + edInd == indentation and + edInd == prevInd) ): indentation = edInd - 1 elif ( @@ -383,14 +383,11 @@ while curLine >= 0: txt = self.editor.text(curLine) if ( - (rxIndex(self.__defSelfRX, txt) == 0 or - rxIndex(self.__defClsRX, txt) == 0) and - self.editor.indentation(curLine) == indentation - ): - return True - elif ( - rxIndex(self.__classRX, txt) == 0 and - self.editor.indentation(curLine) < indentation + ((rxIndex(self.__defSelfRX, txt) == 0 or + rxIndex(self.__defClsRX, txt) == 0) and + self.editor.indentation(curLine) == indentation) or + (rxIndex(self.__classRX, txt) == 0 and + self.editor.indentation(curLine) < indentation) ): return True elif (