4 ms·
Can someone point me to structures/algorithms to use for text editor which could support files of unlimited lengths (including lines of unlimited length) withou
by vbezhenar 3y ago
Can someone point me to structures/algorithms to use for text editor which could support files of unlimited lengths (including lines of unlimited length) without loading those fully in the buffer?
I miss that editor so much, that I'm considering to write one some day, but I have no idea how to do so. I can invent things myself, but I guess those things were invented already back in the days computers were different.
- celeritascelery 3y agoThat is essentially what VLF[1] does in Emacs. It reads in discrete chunks of the file at a time and doesn’t load the next one till you try to display it. Doesn’t require any fancy data structures, just some extra book keeping and mechanics. [1] https://github.com/m00natic/vlfi https://github.com/m00natic/vlfi
- modernerd 3y agoYou might be interested in ewig and immer by Juan Pedro Bolivar Puente: https://github.com/arximboldi/ewig https://github.com/arximboldi/ewig https://github.com/arximboldi/immer https://github.com/arximboldi/immer See the author instantly opening a ~1GB text file with async loading, paging through, copying/pasting, and undoing/redoing in their prototype “ewig” text editor about 27 minutes into their talk here: https://m.youtube.com/watch?v=sPhpelUfu8Q https://m.youtube.com/watch?v=sPhpelUfu8Q It’s backed by a “vector of vectors” data structure called a relaxed radix balanced tree: https://infoscience.epfl.ch/record/169879/files/RMTrees.pdf https://infoscience.epfl.ch/record/169879/files/RMTrees.pdf That original paper has seen lots of attention and attempts at performance improvements, such as: https://hypirion.com/musings/thesis https://hypirion.com/musings/thesis https://github.com/hyPiRion/c-rrb https://github.com/hyPiRion/c-rrb