This is a continuation of the discussion in the thread "Leo 4.9 b1 for
June"
http://groups.google.com/group/leo-editor/browse_thread/thread/e8d43355e1384c5a

Here I shall discuss the design difficulties in supporting per-node
undo.  As I said earlier, the code itself is clean, but as we shall
see it sweeps too much under the rug.

To state my conclusion first: local undo is likely impossible.  Otoh,
node versioning, which aims at recreating only the text (headline or
body) of nodes, is quite feasible.

There are two interrelated difficulties with local undo.  The first is
serious, the second is fatal.

1. Per-node undo is not sufficient.  We need *both* a global undo and
a local undo.

The user must be able to choose which is desired.  Naturally, this
leads to increased complexity in a frequently-used feature.  This kind
of change is always problematic.

Furthermore, there are (or would be) grave difficulties in correlating
local and global undo operations.  However, we can ignore these
difficulties because the next problem is intractable.

2. Per-node undo is invalid.

In effect, the present per-node undo partitions all actions by vnode.
There is no global undo at all. That is, each vnode has its *own* undo
stack.

Alas, in general it is invalid to treat operations this way.  For
example, suppose a local undo stack contains an entry for move-outline-
up command.  When executed in a *global* context (that is, with a
global undo stack), the Leo outline is guaranteed to be in a state in
which this undo operation is valid.

But the operation may not be valid when the undo entry appears in a
*local* context.  To see this, suppose the global stack contains a
promote or demote operation.  This operation affects children, but
this operation does *not* appear in the local undo stack for the
children.  Thus, a node may have a prior sibling in a global context
(after a series of global undos), but might *not* have such a sibling
after a series of local undos.

This is a show-stopper.

In short, node versioning, which affects only the headline and body
text of nodes, is the only possible form of per-node undo.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to