making an editor for something and trying to figure out how to implement undo/redo, in the past I would just save the file to memory after every change and store it in a stack, but this editor the files are gonna be tens of megabytes in size
-
Show this thread
-
so instead I decided to structure the editor so that tools only ever create "commands" that change the thing you're editing, and all commands have to be reversible (individual commands can store the previous state of what they changed)
3 replies 0 retweets 27 likesShow this thread -
I guess this is an existing "design pattern" but also I still hate all "design patterns"
7 replies 0 retweets 34 likesShow this thread -
Replying to @TylerGlaiel
You can still do it your old way if you want. Just use a fast hash (like Meow), and hash blocks of the file, then store the list of hashes instead of the whole file.
2 replies 0 retweets 3 likes
Replying to @cmuratori @TylerGlaiel
(Bonus: save the hash lists, and you get backups for free).
6:22 PM - 5 Mar 2021
0 replies
0 retweets
0 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.