Hi, I'm updating a treeview (showing a list of functions, etc. in the current document), after text has been inserted or deleted from a Scintilla control with a custom lexer. The treeview is updated based on the text inserted, its style data, and information on where the insert/delete takes place and the number of lines added/removed.
Handling SC_MOD_INSERTTEXT and SC_MOD_DELETETEXT in the SCN_MODIFIED notification would be perfect except that the style data has not been updated at this point (SCN_STYLENEEDED is sent later) and it is not permitted to perform the styling in SCN_MODIFIED. At the moment i am styling it in a separate buffer when SC_MOD_INSERTTEXT/SC_MOD_DELETETEXT is received and then performing the update. However, this wastes time and memory because the text has to be styled later in SCN_STYLENEEDED so i wish to avoid this double styling. I am thinking perhaps i should create a queue of the relevant SC_MOD_INSERTTEXT/SC_MOD_DELETETEXT information and process it in SCN_STYLENEEDED after styling has taken place. Or is it guaranteed there is a 1-1 relationship between SC_MOD_INSERTTEXT/SC_MOD_DELETETEXT and SCN_STYLENEEDED, i.e. for each insert/delete there will be one and only one SCN_STYLENEEDED (sent before any more insert/delete notifications) so i can abandon the queue and handle the one latest insert/delete in SCN_STYLENEEDED? Or is there (hopefully!) a simpler method? Thanks, Matt _______________________________________________ Scintilla-interest mailing list [email protected] http://mailman.lyra.org/mailman/listinfo/scintilla-interest
