Fixes #379
Undo now works in batches for certain commands.