Mitchell:
> I am setting a lexer via SCI_SETILEXER, but all of my document's styling information still exists. I have to call one of SCI_COLOURISE, SCI_SETKEYWORDS, SCI_SETPROPERTY, etc. in order to trigger re-lexing. Is there a reason why SCI_SETILEXER does not immediately invalidate all styling information?
Back on 4.x, SCI_SETLEXER and SCI_SETLEXERLANGUAGE would have no effect if called with the same language as already set. Existing applications often reevaluate configuration and call APIs with the same value as before so Scintilla has some code to detect changes and avoid work for null updates. SCI_SETILEXER has a different concept of lexer identity with each call to create a lexer returning a new ILexer*. If each call to SCI_SETILEXER cleared out styling then they would be much more expensive for effectively null updates and existing applications would show worse performance when updated to 5.x.
Its easier for applications to restart lexing after a reset that they think is significant than to preserve styling for insignificant updates so SCI_SETILEXER was implemented to preserve current styling.
Neil