234 while ifLine >= 0: |
234 while ifLine >= 0: |
235 txt = self.editor.text(ifLine) |
235 txt = self.editor.text(ifLine) |
236 edInd = self.editor.indentation(ifLine) |
236 edInd = self.editor.indentation(ifLine) |
237 if self.__elseRX.indexIn(txt) == 0 and edInd <= indentation: |
237 if self.__elseRX.indexIn(txt) == 0 and edInd <= indentation: |
238 indentation = edInd - 1 |
238 indentation = edInd - 1 |
239 elif (self.__ifRX.indexIn(txt) == 0 or \ |
239 elif (self.__ifRX.indexIn(txt) == 0 or |
240 self.__elifRX.indexIn(txt) == 0) and edInd <= indentation: |
240 self.__elifRX.indexIn(txt) == 0) and edInd <= indentation: |
241 self.editor.cancelList() |
241 self.editor.cancelList() |
242 self.editor.setIndentation(line, edInd) |
242 self.editor.setIndentation(line, edInd) |
243 break |
243 break |
244 ifLine -= 1 |
244 ifLine -= 1 |
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 |
283 indentation = self.editor.indentation(line) |
283 indentation = self.editor.indentation(line) |
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 edInd <= indentation: |
290 indentation = edInd - 1 |
290 indentation = edInd - 1 |
291 elif (self.__exceptRX.indexIn(txt) == 0 or \ |
291 elif (self.__exceptRX.indexIn(txt) == 0 or |
292 self.__tryRX.indexIn(txt) == 0) and edInd <= indentation: |
292 self.__tryRX.indexIn(txt) == 0) and edInd <= indentation: |
293 self.editor.cancelList() |
293 self.editor.cancelList() |
294 self.editor.setIndentation(line, edInd) |
294 self.editor.setIndentation(line, edInd) |
295 break |
295 break |
296 tryLine -= 1 |
296 tryLine -= 1 |
305 tryLine = line - 1 |
305 tryLine = line - 1 |
306 while tryLine >= 0: |
306 while tryLine >= 0: |
307 txt = self.editor.text(tryLine) |
307 txt = self.editor.text(tryLine) |
308 edInd = self.editor.indentation(tryLine) |
308 edInd = self.editor.indentation(tryLine) |
309 if self.__py24StyleTry: |
309 if self.__py24StyleTry: |
310 if (self.__exceptcRX.indexIn(txt) == 0 or \ |
310 if (self.__exceptcRX.indexIn(txt) == 0 or |
311 self.__exceptRX.indexIn(txt) == 0 or \ |
311 self.__exceptRX.indexIn(txt) == 0 or |
312 self.__finallyRX.indexIn(txt) == 0) and \ |
312 self.__finallyRX.indexIn(txt) == 0) and \ |
313 edInd <= indentation: |
313 edInd <= indentation: |
314 indentation = edInd - 1 |
314 indentation = edInd - 1 |
315 elif self.__tryRX.indexIn(txt) == 0 and edInd <= indentation: |
315 elif self.__tryRX.indexIn(txt) == 0 and edInd <= indentation: |
316 self.editor.cancelList() |
316 self.editor.cancelList() |
317 self.editor.setIndentation(line, edInd) |
317 self.editor.setIndentation(line, edInd) |
318 break |
318 break |
319 else: |
319 else: |
320 if self.__finallyRX.indexIn(txt) == 0 and edInd <= indentation: |
320 if self.__finallyRX.indexIn(txt) == 0 and edInd <= indentation: |
321 indentation = edInd - 1 |
321 indentation = edInd - 1 |
322 elif (self.__tryRX.indexIn(txt) == 0 or \ |
322 elif (self.__tryRX.indexIn(txt) == 0 or |
323 self.__exceptcRX.indexIn(txt) == 0 or \ |
323 self.__exceptcRX.indexIn(txt) == 0 or |
324 self.__exceptRX.indexIn(txt) == 0) and \ |
324 self.__exceptRX.indexIn(txt) == 0) and \ |
325 edInd <= indentation: |
325 edInd <= indentation: |
326 self.editor.cancelList() |
326 self.editor.cancelList() |
327 self.editor.setIndentation(line, edInd) |
327 self.editor.setIndentation(line, edInd) |
328 break |
328 break |
360 line, col = self.editor.getCursorPosition() |
360 line, col = self.editor.getCursorPosition() |
361 indentation = self.editor.indentation(line) |
361 indentation = self.editor.indentation(line) |
362 curLine = line - 1 |
362 curLine = line - 1 |
363 while curLine >= 0: |
363 while curLine >= 0: |
364 txt = self.editor.text(curLine) |
364 txt = self.editor.text(curLine) |
365 if (self.__defSelfRX.indexIn(txt) == 0 or \ |
365 if (self.__defSelfRX.indexIn(txt) == 0 or |
366 self.__defClsRX.indexIn(txt) == 0) and \ |
366 self.__defClsRX.indexIn(txt) == 0) and \ |
367 self.editor.indentation(curLine) == indentation: |
367 self.editor.indentation(curLine) == indentation: |
368 return True |
368 return True |
369 elif self.__classRX.indexIn(txt) == 0 and \ |
369 elif self.__classRX.indexIn(txt) == 0 and \ |
370 self.editor.indentation(curLine) < indentation: |
370 self.editor.indentation(curLine) < indentation: |