I've been learning a lot lately by following along with the development of xi[1], a new text editor written in Rust. Through reading that project's RFCs I've then come across other interesting projects, like swiobe[2] and wi[3].<p>What are the other canonical resources on this topic? It feels like tons of the interesting thought is scattered around various blogs and usenet posts and the like. I'd love to create a nice collection of good writing on text-editing / tools, but I'm not sure where to start.<p>[1] <a href="https://github.com/google/xi-editor" rel="nofollow">https://github.com/google/xi-editor</a><p>[2] <a href="https://github.com/swiboe/swiboe" rel="nofollow">https://github.com/swiboe/swiboe</a><p>[3] <a href="https://github.com/wi-ed/wi" rel="nofollow">https://github.com/wi-ed/wi</a>
A paper that covers some of the data structures used in editors is:<p><a href="https://www.cs.unm.edu/~crowley/papers/sds.pdf" rel="nofollow">https://www.cs.unm.edu/~crowley/papers/sds.pdf</a><p>The gap buffer, in particular, is a great example of a simple yet powerful idea that is perfectly suited to the problem domain.
Fun blast from the past. The original version of this shipped with Mark of the Unicorn's Mince/Scribble package for CP/M. (Mince = Mince Is Not Complete Emacs)
I once build a text editor using a rope[1] data structure where every line was a node. The tree was augmented[2] with information about line numbers, titles in the document... for very fast navigation. I don't think primitive data structures like a gap buffer are useful anymore. They come from a time where saving on memory was more important than it is now.<p>EDIT: I forgot it was also a self balancing tree! Very cool stuff.<p>[1] <a href="https://en.wikipedia.org/wiki/Rope_(data_structure)" rel="nofollow">https://en.wikipedia.org/wiki/Rope_(data_structure)</a>
[2] <a href="https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree" rel="nofollow">https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree</a>
> In its most general form, text editing is the process of taking some input, changing it, and producing some output.<p>Funny how similar that definition is to the "programming" one.
As someone currently working on a code editor I love this stuff, but there's usually more focus on the technical part then the human part. With todays hardware we can do millions of stupid things every second and it will still feel snappy. We should spend more time trying to optimize for the humans instead of their computer.