[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] The undo feature
From: |
Mark Majeres |
Subject: |
Re: [Nano-devel] The undo feature |
Date: |
Tue, 28 Oct 2014 18:46:46 -0700 |
On 10/28/14, Erik Lundin <address@hidden> wrote:
>
>> 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>
>
>
Erik,
You must be overlooking the while loops in do_redo and do_undo for the
cases SPLIT_BEGIN and SPLIT_END. If the position of the linked list
of undo objects ends up in the middle of SPLIT_BEGIN and SPLIT_END
then something terrible has gone wrong. The scenario will not happen,
you do not need to worry about this.
You only need to create an undo type for your function. something
similar to the SPLIT_BEGIN and SPIT_END pair. You can then string
together functions that have already been developed and tested.
--Mark Majeres
- [Nano-devel] The undo feature, Erik Lundin, 2014/10/21
- Re: [Nano-devel] The undo feature, Erik Lundin, 2014/10/21
- Re: [Nano-devel] The undo feature, Benno Schulenberg, 2014/10/21
- Re: [Nano-devel] The undo feature, Mark Majeres, 2014/10/21
- Re: [Nano-devel] The undo feature, Erik Lundin, 2014/10/27
- Re: [Nano-devel] The undo feature, Benno Schulenberg, 2014/10/28
- Re: [Nano-devel] The undo feature, Mark Majeres, 2014/10/28
- Re: [Nano-devel] The undo feature, Erik Lundin, 2014/10/28
- Re: [Nano-devel] The undo feature,
Mark Majeres <=
- Re: [Nano-devel] The undo feature, Erik Lundin, 2014/10/29
- Re: [Nano-devel] The undo feature, Mark Majeres, 2014/10/29
- Re: [Nano-devel] The undo feature, Mark Majeres, 2014/10/31
- Re: [Nano-devel] The undo feature, Erik Lundin, 2014/10/31
- Message not available
- Re: [Nano-devel] The undo feature, Erik Lundin, 2014/10/31
- Re: [Nano-devel] The undo feature, Benno Schulenberg, 2014/10/31
- Re: [Nano-devel] The undo feature, Chris Allegretta, 2014/10/29