I've worked on a text editor last year. The idea was to get to do some IDE like tooling at some point, but that might never happen. I intended to make incremental parsing work but I still haven't got a good approach figured out that wouldn't rely on dry parser theory and code generation.
Anyway, since @seventh-chord asked about text buffers. That text editor can easily handle multi-gigabyte files in-memory since it is supported by a text rope that I did, which is again supported by an RB tree that I did. Small inserts/deletes anywhere in the file, even with 2G of text loaded, take only 5-50 microseconds to complete.
The textrope itself doesn't really have a notion of text but it's just a storage for binary data that can efficiently handle insertions and deletions. The only thing it currently does is count UTF-8 leader bytes and 0x0a bytes. On top of that is a layer for "real" text handling, like movement by codepoints, words, lines, and so on.
If you want to take a look at it, the project is at
https://github.com/jstimpfle/astedit. The things I described above are mostly in the files rb3ptr.c (RB tree), textrope.c (storage), and textedit.c / textpositions.c (movement).
(Note, if you want to try it out: it's barely usable, and it has a VIM-like interface. There is no documentation. There is insertion, deletion, selection (with v key), and a really bad undo-redo system. There is a command-mode that you enter with : just like in VIM. It has 'w [FILE]', 'r FILE', and 'g <N>' (goto line) commands. There is not even copy-paste.)