7 ms·
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 th
by EdiX 11y ago
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.