400 |
400 |
401 def checkSelection(self): |
401 def checkSelection(self): |
402 """ |
402 """ |
403 Public method to check the current selection. |
403 Public method to check the current selection. |
404 """ |
404 """ |
405 selStartLine, selStartIndex, selEndLine, selEndIndex = \ |
405 selStartLine, selStartIndex, selEndLine, selEndIndex = ( |
406 self.editor.getSelection() |
406 self.editor.getSelection() |
|
407 ) |
407 self.__checkDocumentPart( |
408 self.__checkDocumentPart( |
408 self.editor.positionFromLineIndex(selStartLine, selStartIndex), |
409 self.editor.positionFromLineIndex(selStartLine, selStartIndex), |
409 self.editor.positionFromLineIndex(selEndLine, selEndIndex) |
410 self.editor.positionFromLineIndex(selEndLine, selEndIndex) |
410 ) |
411 ) |
411 |
412 |
521 @exception StopIteration raised to indicate the end of the iteration |
522 @exception StopIteration raised to indicate the end of the iteration |
522 """ |
523 """ |
523 spell = self._spelling_dict |
524 spell = self._spelling_dict |
524 if spell: |
525 if spell: |
525 while self.pos < self.endPos and self.pos >= 0: |
526 while self.pos < self.endPos and self.pos >= 0: |
526 word, wordStart, wordEnd = \ |
527 word, wordStart, wordEnd = self.__getNextWord( |
527 self.__getNextWord(self.pos, self.endPos) |
528 self.pos, self.endPos) |
528 self.pos = wordEnd |
529 self.pos = wordEnd |
529 if (wordEnd - wordStart) >= self.minimumWordSize and \ |
530 if ( |
530 self.__checkRegion(wordStart): |
531 (wordEnd - wordStart) >= self.minimumWordSize and |
|
532 self.__checkRegion(wordStart) |
|
533 ): |
531 try: |
534 try: |
532 if spell.check(word): |
535 if spell.check(word): |
533 continue |
536 continue |
534 except enchant.errors.Error: |
537 except enchant.errors.Error: |
535 # ignore these |
538 # ignore these |