3 ms·
Weird. First idea that came to my mind was to use a linked list of lines.
by vardump 5y ago
Weird. First idea that came to my mind was to use a linked list of lines.
- arc-in-space 5y agoClose, but not ideal - lines are occasionally very long, and you're wasting nodes on sequences of newlines. There's a number of useful data structures that can do this well, like a 'rope'.
- ahefner 5y agoIt works. Many editors have used this approach.
- dvfjsdhgfv 5y agoWhat would you use for a line?