Multi-level Undo?

Matt Maier blueback09 at gmail.com
Sat Jul 23 04:27:05 EDT 2016


I looked into it a while back. A few basic options are:
- rationalize all of the user's actions into a list of named actions, keep
track of the actions in order, and then have the engine execute the list.
if the user uses undo, just move a marker one item backwards in the list,
so that the engine only gets up to the marker. If they use redo, move the
marker ahead one item
- save a complete copy of the working file after every change. use up as
much space as you want and start overwriting the oldest version. if a user
uses undo, load an older version. if they use redo, load a newer version.
- carefully control your engine's options so that they are all perfectly
undoable, with no remainders or side effects. if the user uses undo, just
execute the exact opposite of the last operation. if they use redo, just
execute the exact same operation again.

You can mix and match among these options. I used the first one there and
my files never got anywhere close to big enough that you'd notice they were
being regenerated from scratch after every change. That depends on your
task, though; mine was text and some simple vectors.

On Sat, Jul 23, 2016 at 10:57 AM, Peter Reid <preid at reidit.co.uk> wrote:

> Is there any way of supporting multi-level undo in LiveCode?
>
> My current project provides support for the user to manipulate objects
> (grouped vector objects).  The user can grab objects, move them around the
> window, group/ungroup, align, cut, copy, paste and undo.  However the undo
> is single level only.
>
> Can anyone suggest a way of providing multi-level undo, even if only 3
> levels?
>
> Thanks.
>
> Peter
> --
> Peter Reid
> Loughborough, UK
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list