The rope uses a large leaf-node text length, so in the vast majority of
cases this ends up being the same as directly storing the string data.
But in the case that the line becomes extremely long, this will allow
for reasonable performance
This is a big shift in the formatter API's. It simplifies the
responsibilities of the implementers so that pretty much all they
have to do it implement an iterator. Everything else will be
automatically derived from that. (Or, at least, that's the hope.)
This commit pulls the formatter out of the text buffer and
puts it in the editor instead. However, there is a lot of
commented code utlizing the buffer and formatter that still
needs to be updated.
In short, the editor is pretty non-functional in this commit.
File loading is now the responsibility of the Buffer, which allows
it to do some weird internal stuff to make it faster.
Also, using custom code for scanning the text, so all line endings
are handled now, not just LF and CRLF.
The reformat code was being run on every resize event,
which chokes on most resizes which end up emitting a lot
of resize events. Now it waits and processes a bunch of
resize events until there aren't any left, and only does
the actual reformat on the last one.
The rust SDL2 bindings have changed in a way that makes the lifetimes
very strict. This is probably a good thing from a safety standpoint,
but means I'll likely need to re-architect the GUI drawing code.
For now I'm going to leave that on the back-burner and focus on getting
the console version working.
A LineFormatter determines how a line of text is visually displayed in
2d space. This allows both the Console and GUI version of the editor
to share the same buffer code whilst still handling the differing ways
in which both handle visual display.
It really seems insurmountable at this point. Not sure what SDL is doing
that's causing this. But I'm leaving this code in, because it makes
things a little cleaner and serves as a good example to myself for how
to render to textures.
There is now a CursorSet type that handles multiple cursors, and makes
it convenient to maintain the necessary invariants expected by the rest
of the code for multi-cursor editing.