Re: Suggestion: Rewind-mode instead of undo-tree
- David Schweikert wrote:
> On Mon, Oct 04, 2004 at 10:59:45 +0200, Bram Moolenaar wrote:This part is just like undo. But the states of the text you can go to
> > > OK. It should be clearly marked in the GUI however, so that the user
> > > knows, that it is in this time-shifting or review "mode", where he
> > > can't change anything and can walk backwards and forwards in time.
> > But you _can_ make changes. As soon as you do this a new branch in the
> > tree is created. Just like what happens when you make a change after
> > pressing "u" a few times. The idea is that you can go back to a
> > previous state of the text and continue editing there.
> What's the difference to undo then? I think that in order to implement
> such a time shifting functionality, it should be forbidden to make
> changes and thus create branches, otherwise you have the same problem
> like with undo...
are different. undo/redo walks one line, from root to the end of one
branch, in the undo tree. The "timeshift" commands walk all branches in
the undo tree.
> Let's say it's 17:00 now and you go back to 13:00 with "rewind".If you go back to the state of 13:00 and you make a new change at 17:00,
> You make a change... What are you going to see if you press repeatedly
> the 'rewind' key again?
> 1. the state of 13:00 plus the change (shown as 17:10)
> 2. the state of 17:00
> 3. the state of 13:00
> Feasible, but a little bit confusing in my opinion. Maybe you can
> provide a configurable option to force read-only mode when traversing
> the undo tree with rewind (or how you will call it)...
you get a new state marked with 17:00. Thus this is a new branch,
linked to the state at 13:00. If you "undo" you get to the 13.00 state
again. If you go back in time, you get to the state before the previous
change, which is probably somewhere else.
In a picture:
/ / \
/ / \
14:10 13:10 17:00
Assume you were at 14:20, go back in time to 13:00, then make a
change this becomes a new branch 17:00. Using undo to go from 13:20
to 13:00 it's exactly the same.
Thus when you use "timeshift" commands you can go back in time, and
forward again. This remembers the time of the current text state. As
soon as you make a change you get a text state with the current time as
the timestamp. Thus you can walk from 14:20 to 14:10 ... 13:00 to
12:50, each with one "backward" command. Then go forward from 12:50 to
13:00 with a "forward" command. If you then make a change you create a
new stat 17:00. Now a "backward" command would take you to 14:20. But
an undo would take you to 13:00 and then "backward" to 12:50
Perhaps it would be useful to set time-marks, in case you want to jump
back or forward to a specific text state. That might be complicated
though, just remembering the time is a lot simpler.
"Thou shalt not follow the Null Pointer, for at its end Chaos and
/// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
- On Mon, Oct 04, 2004 at 20:05:04 +0200, Bram Moolenaar wrote:
> [ explanation of the timeshift functionality with the undo tree ]I understand now. Thanks for the explanation! Somehow I was stuck on
thinking about an implementation with a list instead of a tree and there
it would have had some issues. Like you describe it it makes perfect
sense to me... I think it would be a great addition to Vim.
Maybe you could put some text of your mail in the appriopriate help
file: it might help others to understand how it works.
> Perhaps it would be useful to set time-marks, in case you want to jumpWouldn't such a marker be just a pointer to the corresponding node in
> back or forward to a specific text state. That might be complicated
> though, just remembering the time is a lot simpler.
the tree? Sounds cool, but maybe not really that useful.
David Schweikert | phone: +41 44 632 7019
System manager ISG.EE | walk: ETH Zentrum, ETL F24.1
ETH Zurich, Switzerland | web: http://people.ee.ethz.ch/dws