Editing Text (Basics)
Background The problem seems simple: open, edit, and save text files. This can range from JSON files to source code like every other editor. Turns out, this is a relatively difficult problem. The rise of javascript text editors surfaces the performance problem of editing large text. It’s a non-trivial problem. There are several desirable characteristics that editors want: Editors need to optimize for edits. Having immediate feedback for changes is paramount to text editing. This includes editing large files. Editors need to optimize for reads. This is implied for optimized edits so that users can see immediate feedback to their edit. This also includes support for large files. Editors should minimize memory usage. Reduced overhead for storage of text leaves more memory for more text buffers. This is useful for developers editing multiple projects at once (eg - microservices). Different data structures support these requirements in varying degrees of success. For the sake of this article, I’m ignoring many other features editors usually have: ...