5 ms·
I didn't know about this, and it was visualised well. Perhaps a multi-gap gap buffer would help solve the problem of multiple cursors.
by ioquatix 9y ago
I didn't know about this, and it was visualised well. Perhaps a multi-gap gap buffer would help solve the problem of multiple cursors.
- raphlinus 9y agoIf you really want to solve the problem, use a rope. The advantage of gap buffers is simplicity (accounting for the gap is a simple compare with a couple of numbers). Ropes are definitely more complicated, but they have massive advantages in worst-case complexity (most edit and query operations have O(log n) cost).
- blt 9y agoThe simplicity argument is absurd to me. Text editors are some of the most important programs to get right. The complex but high performance data structure is worth the effort. It's like arguing that a GIS program shouldn't use a quadtree.
- raphlinus 9y agoYou don't need to convince me, but you'd be surprised some of the pushback I've gotten[0]. I don't have a lot of experience with GIS, but you're telling me that a linear scan through all the features on a map isn't good enough? :) [0] https://news.ycombinator.com/item?id=14129543 https://news.ycombinator.com/item?id=14129543