View Single Post
Old 08-15-2020, 12:19 PM   #54
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,911
Karma: 6120478
Join Date: Nov 2009
Device: many
BTW, I took a look at how Kovid/Calibre handles real-time red squiggleys for multiple languages and he needed to create his own SyntaxHighlighter (not use QSyntaxHighlighter), that basically constantly runs in its own thread and does the equivalent of a full QuickParser run. It the uses QTextDocument BlockUserData to store parsed state and his own User Defined QTextCharFormat property to store the locale of every character in the file (and therefore lang). These formats are used for local spell check syntax highlighting and since they are associated with each character of the file, as editing is done, the locale info follows the editing just like other character formatting like bold or italic.

Needless to say, I really do not think this way for Sigil to go at all. I would rather allow the user to specify a Primary Language Dictionary (as now) and add a Secondary Language Dictionary controllable in Preferences.

If no secondary language dictionary is set by the user, it is just like real time red sqiggley spellchecking now.

If a secondary language dictionary is set by the user, the word is checked in both to determine the state of red squiggleys now.

Using the SpellCheckEditor will always properly handle spellchecking by lang or xml:lang attribute in as many languages that are used that have associated dictionaries installed.

This way in Sigil, real-time red sqiggley spellcheck highlighting will serve a slightly different functionality (as determined by the user preferences) for up to 2 languages for use cases with no or improper use of lang or xml:lang attributes. While the full SpellCheckEditor will handle the use cases of proper use of language tags.
KevinH is offline   Reply With Quote