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.