QScintilla/TypingCompleters/CompleterPython.py

changeset 3039
8dd0165d805d
parent 3034
7ce719013078
child 3060
5883ce99ee12
child 3160
209a07d7e401
equal deleted inserted replaced
3038:7fe9a53280bd 3039:8dd0165d805d
257 txt = self.editor.text(ifLine) 257 txt = self.editor.text(ifLine)
258 edInd = self.editor.indentation(ifLine) 258 edInd = self.editor.indentation(ifLine)
259 if self.__elseRX.indexIn(txt) == 0 and edInd <= indentation: 259 if self.__elseRX.indexIn(txt) == 0 and edInd <= indentation:
260 indentation = edInd - 1 260 indentation = edInd - 1
261 elif self.__elifRX.indexIn(txt) == 0 and \ 261 elif self.__elifRX.indexIn(txt) == 0 and \
262 edInd == indentation and \ 262 edInd == indentation and \
263 edInd == prevInd: 263 edInd == prevInd:
264 indentation = edInd - 1 264 indentation = edInd - 1
265 elif (self.__ifRX.indexIn(txt) == 0 or 265 elif (self.__ifRX.indexIn(txt) == 0 or
266 self.__whileRX.indexIn(txt) == 0 or 266 self.__whileRX.indexIn(txt) == 0 or
267 self.__forRX.indexIn(txt) == 0 or 267 self.__forRX.indexIn(txt) == 0 or
268 self.__tryRX.indexIn(txt) == 0) and \ 268 self.__tryRX.indexIn(txt) == 0) and \
269 edInd <= indentation: 269 edInd <= indentation:
270 self.editor.cancelList() 270 self.editor.cancelList()
271 self.editor.setIndentation(line, edInd) 271 self.editor.setIndentation(line, edInd)
272 break 272 break
273 ifLine -= 1 273 ifLine -= 1
274 274
284 tryLine = line - 1 284 tryLine = line - 1
285 while tryLine >= 0: 285 while tryLine >= 0:
286 txt = self.editor.text(tryLine) 286 txt = self.editor.text(tryLine)
287 edInd = self.editor.indentation(tryLine) 287 edInd = self.editor.indentation(tryLine)
288 if (self.__exceptcRX.indexIn(txt) == 0 or 288 if (self.__exceptcRX.indexIn(txt) == 0 or
289 self.__finallyRX.indexIn(txt) == 0) and edInd <= indentation: 289 self.__finallyRX.indexIn(txt) == 0) and \
290 edInd <= indentation:
290 indentation = edInd - 1 291 indentation = edInd - 1
291 elif (self.__exceptRX.indexIn(txt) == 0 or 292 elif (self.__exceptRX.indexIn(txt) == 0 or
292 self.__tryRX.indexIn(txt) == 0) and edInd <= indentation: 293 self.__tryRX.indexIn(txt) == 0) and edInd <= indentation:
293 self.editor.cancelList() 294 self.editor.cancelList()
294 self.editor.setIndentation(line, edInd) 295 self.editor.setIndentation(line, edInd)
365 if (self.__defSelfRX.indexIn(txt) == 0 or 366 if (self.__defSelfRX.indexIn(txt) == 0 or
366 self.__defClsRX.indexIn(txt) == 0) and \ 367 self.__defClsRX.indexIn(txt) == 0) and \
367 self.editor.indentation(curLine) == indentation: 368 self.editor.indentation(curLine) == indentation:
368 return True 369 return True
369 elif self.__classRX.indexIn(txt) == 0 and \ 370 elif self.__classRX.indexIn(txt) == 0 and \
370 self.editor.indentation(curLine) < indentation: 371 self.editor.indentation(curLine) < indentation:
371 return True 372 return True
372 elif self.__defRX.indexIn(txt) == 0 and \ 373 elif self.__defRX.indexIn(txt) == 0 and \
373 self.editor.indentation(curLine) <= indentation: 374 self.editor.indentation(curLine) <= indentation:
374 return False 375 return False
375 curLine -= 1 376 curLine -= 1
376 return False 377 return False
377 378
378 def __isClassMethodDef(self): 379 def __isClassMethodDef(self):

eric ide

mercurial