<p>Ok, this is a bit of a cheeky question. I want to build a simple text editor (using my own text mode screen handling). I just want a good example of data structures that can be used to represent the text buffer, and some simple examples of char/text insertion/deletion. I can handle all the rest of the code myself (file i/o, console i/o etc). A link to a nice simple editor source would be great (C or C++).</p>

The "Gang of Four" book (
Design Patterns
) has a GUI-based text editor as it's main source of examples and is a worthwhile book to own.
The general "pure text" editor probably uses ropes, which SGI's STL has an
implementation
of. Basically, they are a linked list of character buffers. That way, inserting/deleting characters involves changing smaller buffers and a few pointers, instead of storing the entire document in a single buffer and having to shift everything.