1. m_pSpellHelper->HasStyleToBeChecked(lang, stc->GetStyleAt(pos)) in OnlineSpellChecker::DoSetIndications is wrong. It should be using wordstart
fixed
2. pos++ in the same loop is suspicious. Why don't you move with a whole word if HasStyleToBeChecked returns false?
because this can end in an infinite loop.
if i use this code:
I tested it and found this case: End of line
1) Word start is 0 ('*') word end is 0 ('*')
1.1) pos = wordend (0) + 1 == 1
2) Word start is 1 ('\n') word end is 1 ('\n')
2.1) pos = wordend (1) + 1 == 2
3) Word start is 1 ('\n') word end is 1 ('\n') because '\r' is not used as word start
3.1) pos = wordend (1) + 1 == 2
4 ...... (endless loop)
pos++ guarantees that strange word combinations are skipped (for example faulty utf code points scintilla can not parse, purely speculative)....
3. do you need to WordEndPosition if WordStartPosition fails?
This really sounds like premature optimization (and what did Knuth tell us about that?) Anyway, i added a check for it
4. wordstart and wordend variables could have smaller scope, they aren't used outside of the loop
fixed
5. m_invalidatedRangesStart and m_invalidatedRangesEnd are (almost) already at word boundaries, why don't you take advantage of this, or even don't do the word boundaries adjustment for them
This two variables contain the whole invalidated/modified text. This range is also used to remove the marker. So the whole block that has to be rechecked is invalidated at one call. If we split this range into single words, we get rid of two messages calls and loose this advantages, because we call a lot more times IndicatorSetStyle (for every word, that can also be a single charachter)... No gain for speed here...
6. What happens if some of the new function calls return wrong result in SpellCheckerPlugin::OnThesaurus? Is no the selection case handled correctly there?
Yes and i added additional checks
7. Same in SpellCheckerPlugin::OnCamelCase
see above
I have committed the code now (revision: 11888)... I think we are at a good point and i would like to have it tested in the next nightly....
Thank you again!