Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Weird. First idea that came to my mind was to use a linked list of lines.


Close, 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'.


It works. Many editors have used this approach.


What would you use for a line?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: