If I jump too far away (i.e., from chapter 1 to 700), the text on screen is not highlighted. It gets highlighted as soon as I scroll a bit or edit the chapter.
Am I missing something? Is there a way to force a refresh?
Parsing work is throttled so as to not slow down the UI and not waste too much cpu/battery/power. That means that if you are way down a big document, it may take a while to catch up, and if the editor isn’t active, it may stop doing work altogether on the assumption that the user isn’t working with it.
Looks like new work time is only being allocated when the viewport (for scrolling) or the document changes. I guess we could extend that to also respond to selection updates (and thus to clicks). But that still won’t guarantee you’ll get highlighting when leaving the editor idle somewhere down a big document. The fact remains that catching up with parsing on the bottom of a big document is going to potentially be a lot of work, and that it’s a bad idea for a UI component to just keep spinning and using CPU when idle.
The scroll will be triggering a new time budget chunk for the highlighter. But it runs out of that budget before finishing highlighting up to the visible code, and since there’s no further activity, it will go idle. This is how it is supposed to behave.