When creating a display buffer for buffers that already have fold
markers, which we'll eventually do on refresh, basing folds on
full-blown display buffer markers is a problem because we end up
creating display buffer markers during construction of the line map.
When we create a display buffer marker it memoizes its screen positions,
but since the line map isn't built yet we have nothing to translate
against. Basically, since the line map depends on folds, folds can't
depend on the line map. Luckily, they don't need to. Buffer markers
work just fine.
Because we don't currently allow for direct manipulation of fold
marker ranges, if a fold's marker changes it will be because of a
buffer change. This buffer change will bubble to the display buffer
anyway, where the screen line update will account for the change to
the fold's marker range.
Still a couple of specs failing on this for changes that straddle the
start / end of a fold. We need a new marker invalidation strategy for
these cases.
The idea is that the DisplayBuffer serves a similar role to the Buffer, except that it's holding content in an arrangement that's optimized for display.
We're handling changes that straddle the start row and are in the middle of the fold, but we're still screwing up when the old range straddles the end row.