nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] The undo feature


From: Erik Lundin
Subject: Re: [Nano-devel] The undo feature
Date: Tue, 28 Oct 2014 23:09:43 +0100

> The undo code is really not that complicated.  Can you further
> elaborate on the idea for re-doing the entire undo function?  I cannot
> imagine that redoing everything would be less complicated than
> implementing an "undo step" function.  However, I don't understand
> what that is exactly.  Please also describe the complications that you
> foresee in creating this "undo step" function.
> 
> --Mark Majeres

For example:

UNDO LIST:
1.SPLIT_BEGIN
2.UNDO(TYPE1)
3.SUBUNDO(ADD LINE)
4.SUBUNDO(ADD LINE)
5.SUBUNDO(ADD LINE)
6.SPLIT_END
7.SPLIT_BEGIN
8.UNDO(TYPE2)
9.SUBUNDO(CHANGE LINE)
10.SUBUNDO(CHANGE LINE)
11.SUBUNDO(CHANGE LINE)
12.SUBUNDO(CHANGE LINE)
13.SUBUNDO(CHANGE LINE)
14.SUBUNDO(CHANGE LINE)
15.SPLIT_END

Let's say that the user has made the changes as noted in the undo list
above. He then steps back parts of the whole last transaction of events
back to nr 11. He then starts doing something else that creates a new
undo. You now have to free the linked list from node 11 forward and then
insert a new SPLIT_END marker so that he can undo the remaining part of
the undo-set in one action. But since not all undo types are part of a
SPLIT_BEGIN/END set, you have to check if the current undo is part of a
set when you do this.

My suggestion was to make the undo feature more general. More focused on
the changes being made then how each function should undo it's action.
Since all modifications are either done as a set of changes (search
+replace all/multi row indentation etc) or on a single line (re
indentation on current line etc). My idea was to make the undo structure
as follows:

UNDO LIST:
UNDO(TYPE1)->3x SUBUNDO(ADD LINE)
UNDO(TYPE2)->6x SUBUNDO(CHANGE LINE)

The first level of undos is a linked list that contains all the sets.
And then each undo contains a linked list of subundos. This way it's
easier to clear the remaining subundos and then add a new root undo (if
the users adds a new undo set in the middle of a stepped undo). It's
also easier to notify the user what he/she undid.

Maybe I've misunderstood the current undo feature? If i have please
correct me.

-- 
Erik Lundin <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]