Gap Buffers: a data structure for editable text(routley.io) |
Gap Buffers: a data structure for editable text(routley.io) |
Piece chains are another good data structure to know for this application, though their implementation is more complex than a gap buffer. See http://www.catch22.net/tuts/piece-chains for a nice tutorial.
Also worth reading for insight and motivation is the 1985 CACM article "Concepts of the text editor Lara" by J. Gutknecht.