marijnh/CodeMirror — pull request #1228 by Page- (2013-02-08 16:08:07+00:00)
Title: Add a "highlightMargin" option.

This is to make it possible to specify how far past the viewport to generate highlighting styles, this is useful for me as I have a mode which has all of the processing cost front-loaded onto the first token call (it needs to process all the tokens that will be needed in one go - not ideal at all, but it isn't really avoidable for this case).
Anyway, one of the issues with this is that it nullifies the work done in CodeMirror to keep things responsive, meaning I have to take those same/similar measures myself. One being to only process what will actually be visible to the user (so as to make typing significantly more responsive, even though it does make scrolling less responsive). This worked great up until b31f73e98c36aca38b0af2b0d8f6a49905e4f8d4 when the amount of highlighting styles processed increases to more than the visible area - which means I can no longer only process those tokens which fall into the visible area.

This option will allow me to use this optimisation once again and whilst I expect is a very niche option I hope that the the code to support it is small enough to not be a burden.