| ▲ | aka-rider 3 days ago | |
>files might diverge The way rune works with files minimizes chances of silent corruption. I keep original byte blobs immutable, separately there is a journal (kinda WAL) of positional deltas (inserts and deletes). So I only need to validate that blob + deltas = snapshot. Disk IO is encapsulated through VFS, and writes are atomics (write to a temp file, then rename). Separate virtual rendering buffer is built on top of that. Rune, like Obsidian, renders markdown preview inline, so the same chunk could be rendered as "Header" as well as `## Header` when under the cursor. All of that makes it quite easy to work with text. The core function is to translate offset in a byte array to line and column and back, which is pure math and relatively easy to test. Another trick that helped a lot is to use sqlite extensively: blobs, deltas, vfs, redo and undo history graph are all sqlite tables. I noticed that LLMs make stupid decisions when it comes to data structures, but they understand CRUD and SQL, so I turned all Rune's internals into dumb CRUD. | ||
| ▲ | coder-pm 3 days ago | parent [-] | |
Nice trick with the structures, good for agent legibility! I will try it out on the right occasion:) | ||