I have also just found another case where the highlighting goes wrong (C++).
Near top of file I had `struct Foo{};` a definition, so `Foo` was highlighted
everywhere.
Changed it to a forward `struct Foo;` so `Foo` was unhighlighted since forwards
don't cause highlighting (why is another question).
Scrolled down a bit and added `struct Foo { some stuff };` and all visible
instances of `Foo` were highlighted, but scroll back and previous instances of
`Foo` were not highlighted.
The same happens when previous instances were highlighted and a change is made
that should unhighlight all instances, those before the first visible line
remain highlighted.
Essentially any change to the file that causes a change in highlighting seems
to not be applied before the current first visible line.
IIUC Scintilla considers the styling to be invalid from some point forward, so
if we tell Scintilla that the first visible line forward is invalid, it has no
reason to re-lex when scrolling back, since it was before the invalid point.
So if we make any change that may change the lexing in the file we need to
re-lex the whole file, not just the visible bit forward. Such a change is
uploading new wordlists and that should trigger a whole file re-lex.
Unfortunately I don't think we currently have a way of checking if the
wordlists have changed, so that re-lex has to occur each parse.
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1022#issuecomment-218684519