2 ms·
A text editor edits a (potentially very long) string, but apart from, possibly, the likes of Notepad, none of them store that string as a single byte array. So
by Someone 10y ago
A text editor edits a (potentially very long) string, but apart from, possibly, the likes of Notepad, none of them store that string as a single byte array.
So, look at text editor data structures for other representations. Examples:
- https://en.wikipedia.org/wiki/Gap_buffer https://en.wikipedia.org/wiki/Gap_buffer
- https://en.wikipedia.org/wiki/Rope_(computer_science) https://en.wikipedia.org/wiki/Rope_(computer_science)
- https://en.wikipedia.org/wiki/Piece_table https://en.wikipedia.org/wiki/Piece_table