This is part of an effort to disentangle LanguageMode, DisplayBuffer,
and TokenizedBuffer. It should be easy to create a DisplayBuffer
without creating an EditSession… let's get the dependencies flowing
in a single direction.
DisplayBuffer should just focus on providing basic support for folding.
Scanning the structure of the code, looking at scopes, etc is more the
domain of the LanguageMode object.
This saves the state of the rendered lines, the display buffer, the
tokenized buffer, and the buffer to a file. If a problem arises with
rendering, hopefully we can use it to diagnose in which layer things
went awry.
This prevents the editor from synchronously redrawing in specs with
cursors in invalid locations. Markers are always updated under the
hood before a change event is emitted from the Buffer or DisplayBuffer.
We still wait to trigger marker observers, but if their position gets
read, it is up to date.
There are 3 failures, which I think are attributable to the fact that
I'm not emitting events from the when the selection tail changes, and
I'm not emitting redundant events when the head is changed to the
same position it was previously, whereas before I wasn't guarding
against redundant events.
This is needed by the snippets package, which needs to know where the
cursor was previously when it moves to decide whether to cancel the
current snippet.
This is used by cursor to only autoscroll when the marker head is
explicitly moved, so that passive movements caused by buffer insertions
don't trigger autoscrolling.
Whereas marker methods on buffer take for granted that everything is
in buffer coordinates, methods on the DisplayBuffer offer both
screen and buffer coordinate versions of the marker API.
These will replace anchors, but they won't be stored on the Buffer
at all. The API user will access them by a returned scalar id rather
than calling methods on the returned anchor object directly.
This will prevent running a bunch of background tokenization when Atom is reloaded. We only perform tokenization to support content that is actually on screen.