> The biggest challenge is figuring out how to store the text document in memory. My first thought was to use an array, but that has horrible performance if the user inserts text anywhere other than the end of the document.
I guess this is only an issue in low level languages, as I just used a JavaScript string and I don't think it's been a perf issue in 2+ years using my editor full time. Plenty of other things have been, of course - rendering long horizontal lines comes to mind, as my approach to optimisation assumed rendering a single line would be cheap and expanding the logic to render partial lines would add another whole dimension of complexity.
(By "long" I mean an entire minified file, for example.)