David Schweikert wrote:
> On Mon, Oct 04, 2004 at 10:59:45 +0200, Bram Moolenaar wrote:
> > > 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...
This part is just like undo. But the states of the text you can go to
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".
> 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)...
If you go back to the state of 13:00 and you make a new change at 17:00,
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@...
/// 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