3 ms·
I also tried to figure out how some parts of the editor work and why they are so fast, but I couldn’t figure out much from the assembly. Those who are interest
by userbinator 10y ago
I also tried to figure out how some parts of the editor work and why they are so fast, but I couldn’t figure out much from the assembly.
Those who are interested in text editor design may find this series and the links therein useful:
http://www.catch22.net/tuts/neatpad http://www.catch22.net/tuts/neatpad
- trishume 10y agoYah I'd read that, so I looked for signs of a piece table, but couldn't find any. Which doesn't necessarily mean that it isn't using one. I suspect that Sublime Text either doesn't use a piece table, or uses one that only breaks pieces at line boundaries. The reason being that the highlighting relies on running regexes on one line at a time, and it uses oniguruma for this sometimes, and oniguruma requires the entire haystack to be in one array. However, Sublime doesn't highlight super long lines because it would be too slow, so it could break its piece table on incredibly long lines so that editing them could still be fast. I was also looking for fancy rendering and highlighting tricks, but couldn't decipher any.
- mfukar 10y agoRe: data structures, ST could also use ropes, or gap buffers.
- teddyh 10y agoOr the classic The Craft of Text Editing from 1999: http://www.finseth.com/craft/ http://www.finseth.com/craft/