src/eric7/EricWidgets/EricSpellCheckedTextEdit.py

branch
eric7
changeset 9600
367d1b4fcca8
parent 9473
3f23dbf37dbe
child 9643
10839ab864e0
--- a/src/eric7/EricWidgets/EricSpellCheckedTextEdit.py	Fri Dec 09 17:07:18 2022 +0100
+++ b/src/eric7/EricWidgets/EricSpellCheckedTextEdit.py	Sat Dec 10 11:11:08 2022 +0100
@@ -546,10 +546,11 @@
 
             # Build a list of all misspelled words and highlight them
             misspellings = []
-            for (word, pos) in self.__tokenizer(text):
-                if not self.__spellDict.check(word):
-                    self.setFormat(pos, len(word), EnchantHighlighter.ErrorFormat)
-                    misspellings.append((pos, pos + len(word)))
+            with contextlib.suppress(enchant.errors.Error):
+                for (word, pos) in self.__tokenizer(text):
+                    if not self.__spellDict.check(word):
+                        self.setFormat(pos, len(word), EnchantHighlighter.ErrorFormat)
+                        misspellings.append((pos, pos + len(word)))
 
             # Store the list so the context menu can reuse this tokenization
             # pass (Block-relative values so editing other blocks won't

eric ide

mercurial