I wanted to share a personal project that I’ve been working on for some time now: https://github.com/ssddq/editor
At the start, my goal was to learn how Vulkan and GPU programming/rendering worked in general; over time, this slowly morphed into trying to write a streaming-based text editor. Even though it currently lacks too many (indeed, any) features required to be useable, I thought it might be interesting enough to share in its present state.
The things that are most exciting about it (in my opinion) are:
Files are never loaded into memory; edits are instead tracked in an IntMap keyed on byte positions in the base file, which is used to generate a
Stream (Of Char) IO ()on demand.
With a streaming-based approach, line traversal requires knowing the positions of newline (
'\n') characters in the base file, and typically you want to scan these into an array on load – this is surprisingly fast, but can still be a noticeable delay on very large files.
Here, this is done asynchronously, and functions only block when they attempt to force a value in a part of the array that has not been initialized yet. This means that startup (and even editing near the start of the file!) is instant even on extremely large (> 1 GB) files, as long as you have at least 2 CPU cores.