Syntax highlighting disappears if large documents are scrolled fast

I can actually reproduce this issue with the official demo for large documents here: CodeMirror Huge Doc Demo

Just drag the scroll indicator down real fast, and the highlighting gets lost somewhere on the way. I have this problem with much smaller — yet still large — documents, as well. (Firefox 109)

On the demo, it states this is on purpose to consume resources. Which is fine. However, in my use-case, highlighting doesn’t reappear. Even if I scroll back to the very top which has been initially highlighted.

So you end up in a situation where the content at the top is not highlighted at all? Can you set up a reproduction of this?

While preparing a repro, I identified the cause of the problem. I was binding a scroll event handler which called editor.elementAtHeight() on every scroll event. Debouncing the call of the listener solved the problem. Sorry for the trouble. Nothing wrong here with CM6!