Doug Binks on Nostr: A slightly complex part of undo/redo systems is handling reaching the undo/redo ...
A slightly complex part of undo/redo systems is handling reaching the undo/redo limit. One option is to never have a limit, but for now I've opted to handle this.
When you reach the limit you need to remove items from the tail with same undo id. In case of a very large single operation overwhelming the undo storage you also need to reject new operations with the same id you deleted, otherwise you could 'undo' partial operations and get into a worse state than not undoing them.
Published at
2026-05-23 08:35:31 UTCEvent JSON
{
"id": "1db9e5a3c784077e7793585574a091ee06f72a71496810483834b5db1b97b546",
"pubkey": "5deba1e5cf488b37481efab30607c66bc56dec47b20a640c2f8d9d0d97e63f5e",
"created_at": 1779525331,
"kind": 1,
"tags": [
[
"proxy",
"https://mastodon.gamedev.place/users/dougbinks/statuses/116622972137087315",
"activitypub"
],
[
"client",
"Mostr",
"31990:6be38f8c63df7dbf84db7ec4a6e6fbbd8d19dca3b980efad18585c46f04b26f9:mostr",
"wss://relay.ditto.pub"
]
],
"content": "A slightly complex part of undo/redo systems is handling reaching the undo/redo limit. One option is to never have a limit, but for now I've opted to handle this.\n\nWhen you reach the limit you need to remove items from the tail with same undo id. In case of a very large single operation overwhelming the undo storage you also need to reject new operations with the same id you deleted, otherwise you could 'undo' partial operations and get into a worse state than not undoing them.",
"sig": "321b072c5433550e844fde967a3022a040313f01c8b541f3e4079fb883076857927df4e524471f9e14c600c41adbfa2d6ae077dc43ba70d20afabeb837b32ef6"
}