-
Notifications
You must be signed in to change notification settings - Fork 613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix keyword colorization on filetype change #3553
Conversation
When filetype is changed to a compatible filetype (such as C->C++ and then possibly back to C), colorization is lost. It seems that with Scintilla 5, when language-specific highlighting changes, SCI_SETKEYWORDS has to be called again to take effect. By setting keyword_hash to 0 we force Geany to call sci_set_keywords() in document_highlight_tags() which fixes the problem.
Have you checked if this is perhaps a bug in scintilla and maybe fixed by #3551? |
See also analysis here |
I read that but it's not clear to me how that explains the change here. You talk about a failed parser but that is not talked about here. So I assumed @techee came to a different conclusion. |
@kugel- When you posted a suggestion about possible cause/fix here on the pull request, not the issue #3550 where the discussion had happened, it was not clear that you had seen that discussion, so I posted a cross reference to be helpful. The cross referenced post actually agrees with @techee as to the cause and adds detail of the underlying triggers for the bug based on my analysis, so yes it says things not mentioned by @techee. But it is not disagreeing with his identification of the bug. |
I just tried and no, it doesn't fix it unfortunately. It's hard to say whether this is really a bug on the Scintilla side - I didn't investigate what exact Scintilla API gets called in Geany when filetypes change (one would have to go through the many calls in |
I guess this due to |
I've just added the 2.0 milestone here because this affects the ProjectOrganizer plugin and type colorization there. |
LGBI The diagnosis of @zufuliu above makes sense, a new lexer will always need new keywords to be set. This may have been a bug for always, but not exposed until PO started swapping filetypes with abandon. |
OK, merging. |
When filetype is changed to a compatible filetype (such as C->C++ and then possibly back to C), colorization is lost. It seems that with Scintilla 5, when language-specific highlighting changes, SCI_SETKEYWORDS has to be called again to take effect.
By setting keyword_hash to 0 we force Geany to call sci_set_keywords() in document_highlight_tags() which fixes the problem.
Fixes #3550