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

The 8bit Acorn BBC editor called Edit put the entire file in RAM, all the characters before the cursor at the start of RAM, all the characters after at the end. Quick for inserting, but there was a half second delay if you jumped from the top to the bottom of the text.


This data structure is called gap buffer, it's rather common in text editors because it's simple to implement and efficient on the most common use cases.

In the usual implementation the gap is only moved when you actually insert text, not when the cursor is moved, which makes it even more efficient.




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

Search: