Making more progress on this - got universal undo/redo working. The note itself is a copy-on-write immutable structure, as is the list of note elements, and the edited text itself (currently it's copying the whole string every edit, but the API is right, and I plan to switch it out for a piece-tree before too long). That means undo/redo just involve tracking the last/next note pointer and swapping which one is active. Took a bit to retrofit but now it's working. As I build more features, I just have to adhere to the same restrictions and history will apply to those features "for free" (heavy scare quotes). (Oh, and ignore the bug in the middle - still looking into that 😬 )