
Marcin 'Qrczak' Kowalczyk wrote:
2. Use a persistent data structure with logarithmic cost of most operations: a balanced tree of text fragments, called a rope (Hans Boehm has made one for C). "Undo" can be made by simply keeping old versions.
Hard to implement the core data structure. If done right, the rest is easy, in particular "undo" handling is very robust. There are some overheads for all operations, but the cost of operations scales to extreme cases.
The second way is more interesting, but I don't know how to implement a rope in details.
What happens with this method when the display needs refreshing, does the current state have to be recomputed every time ... wouldn't this lead to very slow cursor operations when using 'backspace'? I would have thought a mutable screen-buffer for editing would still be required. Keean.