That's the other reason I went with backup file versions. Well, the FILES-11 system that existed for both RSTS/E and OpenVMS had file versioning by default. I also have live cache files so getting Undo back isn't that big of a deal.
Since my editor is based on grace and functionality of EDT I will tell you from the 10,000 foot level how EDT "solved" this problem.
EDT started out in the PDP-11 world. No user process ever had more than 64K WORDS to operate in. That was for OS, Executable, and data. The "undo history" was stored in a .JOU (journal) file. It was basically an RMS indexed file with variable length records. (We didn't have to deal with the possibility of 10K line cut because the compilers of the day couldn't feed that many lines in.)
Whenever your process got shot out of the saddle for whatever reason, this would leave the .JOU file laying around. Old hands would perform a DIRectory and look for the .JOU file. When found
EDT/RECOVER fred.cob
This would then entertain the developer by loading the "current" source file version and then visually replaying every modification stored in the .JOU file until it displayed the message "file recovered" or some failure message.
Too many young whipersnappers didn't bother to do this so EDT itself got modified to always check for the .JOU file. It would prompt in its little prompt-line region
JOURNAL FILE FOUND . . . would you like to recover (Y/n)?
Answering yes allowed you to be entertained as your 4+ hour edit session that failed to save got replayed before your eyes. Every navigation, every character typed, deleted, blocks moved/deleted, etc. EDT was a multi-buffer editor. You edited a single file, but you could manually create as many buffers as your user quota allowed for RAM and file handles. Unlike later PC editors that believed they were such hot stuff because they allowed a developer to have cut buffers 1-99 they could choose to paste back in, our only real limit to these were how many 6-character-not-starting-with-a-number names we could come up with.
The x86 platform chose not to provide native indexed files. Today you could probably use SQLite with the last column being a BLOB. Theoretically you could do an in-memory database, but I wouldn't. Somewhere someone will have a machine with < 4GB of RAM yet need to edit a really big file.
SQLite insulates the world from additions (but not deletions) of columns and tables.
Despite what many in the x86 world believe, it's not a sin to write to disk.