4 ms·
Is it even possible to write any text editor without some form of rope data structure?
by secondcoming 2y ago
Is it even possible to write any text editor without some form of rope data structure?
- caconym_ 2y agoGap buffers are the other classic option, and there are others too, e.g. piece tables.
- cschmidt 2y agoHere's a paper reviewing the various choices, that is often mentioned in discussions around data structures for text editors: https://www.cs.unm.edu/~crowley/papers/sds.pdf https://www.cs.unm.edu/~crowley/papers/sds.pdf
- marssaxman 2y agoMost certainly: gap buffers, piece tables, and line arrays are also popular choices.
- ben-schaaf 2y agoVSCode uses a piece table (https://code.visualstudio.com/blogs/2018/03/23/text-buffer-reimplementation https://code.visualstudio.com/blogs/2018/03/23/text-buffer-r...).
- canucker2016 2y agoMS Word used piece table, which led to the "fast save" feature - which saved only the newer pieces.