I recently put an editor project on common-lisp.net (http://common-lisp.net/project/vial/). Troels contacted me and rightly asked why I didn't use Flexichain to implement my buffer (I use a linked list of strings basically). I've thought about the two methods (gap buffer vs linked list of lines), and basically the performance for either method is probably about the same for most operations. The one big place that a gapbuffer wins is when you want to treat a large section of the buffer as a read-only string. For a list of lines you need to cons up a new string, for a gap buffer (assuming it is locked), you simply need to move the gap and take a pointer into the gap buffer.
I envision using this "large string" mode of the gap buffer for: - searching one huge string with CL-PPCRE - saving the buffer in one call
So after all my rambling I have two questions: 1) Is it appropriate to use Flexichain in this "one large string" manner? Obviously you don't want to always convert to this form, but it is handy for running a search on the buffer and some other uses. 2) What is involved in creating a function that consolidates the data into a contiguous chunk that is suitable for creating a displaced array into?
Thanks Brad