Linked arrays in different forms are a common solution indeed.
The tricky part is working out what to do next - especially in an environment without any sort of memory protection...
Back to the editor ...
One thing we shouldn't forget is that almost all BASICs are effectively editors for text - inserting and deleting (and, worse) overwriting lines. Most BASICs will store the program text (tokenised or not) linearly with nothing much more than a simple line length of the current line that you need to manipulate to get the start of the next line - yet, they all handle insert and delete very efficiently in the same 64KB address space (often much less, who wrote large BASIC programs that filled memory up back in the day?)
Maybe we ought to study them more and take a leaf out of their books?
My own tinyBasic follows this traditional format too - to overwrite a line, I delete the current line (move memory down), then insert space for the new line (move memory up), then copy the line into the gap. A line has a line number (2 bytes), then the line length byte (one byte) then the line data... And TinyBasic does nothing more - no tokenisation, no formatting, etc. it's almost a 'perfect' line editor... Maybe I'll artificially create a 32KB program in my Ruby system and see just how long it actually takes...
It doesn't have a LIST N command (not enough room to include it, just LIST the whole program), but if it had, then it would need to do a linear search for the line - no worse than GOTO/GOSUB though...
Anyone ever use AppleWorks Writer? I never used it in anger, but the secretaries and admin assistants at the uni I was at used it way back to ptoduce some fairly large documents... I wonder if there are any technical documents about how that worked internally... Maybe we're re-inventing wheels that are already polished and perfectly circular...
-Gordon