Loading ...
Sorry, an error occurred while loading the content.

Re: Suggestion: Rewind-mode instead of undo-tree

Expand Messages
  • Bram Moolenaar
    ... Thanks for writing this down. ... I think this is not a mode, we need commands to go backward and forward in time. This doesn t change the state of Vim,
    Message 1 of 8 , Oct 2, 2004
    • 0 Attachment
      David Schweikert wrote:

      > We did speak about implementing a "undo-tree" in the Vim 7 BOF at the
      > SANE 2004 conference and I tried to explain one possible simplified
      > interface that could be a way to do it. Here is a better explanation and
      > some refinement that I worked out later:

      Thanks for writing this down.

      > Then in in rewind-mode, every time I press the rewind-key, I would get :
      >
      > 0: aaa ddd
      > 1: aaa
      > 2: aaa ccc
      > 3: aaa
      > 4: aaa bbb
      > 5: aaa

      I think this is not a mode, we need commands to go backward and forward
      in time. This doesn't change the state of Vim, only the text.

      We might skip over some parts of the tree when going backward in time,
      especially sequences of undo commands, because they only take you back
      to situations that you have seen before.

      --
      hundred-and-one symptoms of being an internet addict:
      39. You move into a new house and decide to Netscape before you landscape.

      /// 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 ///
    • David Schweikert
      ... 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
      Message 2 of 8 , Oct 4, 2004
      • 0 Attachment
        On Sat, Oct 02, 2004 at 17:29:48 +0200, Bram Moolenaar wrote:
        > I think this is not a mode, we need commands to go backward and forward
        > in time. This doesn't change the state of Vim, only the text.

        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.

        > We might skip over some parts of the tree when going backward in time,
        > especially sequences of undo commands, because they only take you back
        > to situations that you have seen before.

        Yes, I agree...

        Cheers
        David
        --
        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
      • Bram Moolenaar
        ... 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
        Message 3 of 8 , Oct 4, 2004
        • 0 Attachment
          David Schweikert wrote:

          > On Sat, Oct 02, 2004 at 17:29:48 +0200, Bram Moolenaar wrote:
          > > I think this is not a mode, we need commands to go backward and forward
          > > in time. This doesn't change the state of Vim, only the text.
          >
          > 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.

          The only "mode" involved is the position in the undo tree. Like the
          position you get with undo/redo, but measuring in a different way. This
          position is used for the "go to older state" and "go to newer state"
          commands that are to be added.

          --
          hundred-and-one symptoms of being an internet addict:
          61. Your best friends know your e-mail address, but neither your phone number
          nor the address where you live.

          /// 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 ///
        • David Schweikert
          ... 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
          Message 4 of 8 , Oct 4, 2004
          • 0 Attachment
            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...

            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)...

            Cheers
            David
            --
            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
          • Edward L. Fox
            It seems to be too expensive comparing with the benefit, in my opinion.
            Message 5 of 8 , Oct 4, 2004
            • 0 Attachment
              It seems to be too expensive comparing with the benefit, in my opinion.

              On Mon, 4 Oct 2004 18:05:02 +0200, David Schweikert <dws@...> 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...
              >
              > 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)...
              >
              > Cheers
              > David
              > --
              > 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
              >
            • Bram Moolenaar
              ... 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
              Message 6 of 8 , Oct 4, 2004
              • 0 Attachment
                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:

                12:50
                / \
                / \
                14:00 13:00
                / / \
                / / \
                14:10 13:10 17:00
                / /
                / /
                14:20 13:20

                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
                Madness lie."

                /// 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 ///
              • David Schweikert
                ... 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
                Message 7 of 8 , Oct 4, 2004
                • 0 Attachment
                  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 jump
                  > back or forward to a specific text state. That might be complicated
                  > though, just remembering the time is a lot simpler.

                  Wouldn't such a marker be just a pointer to the corresponding node in
                  the tree? Sounds cool, but maybe not really that useful.

                  Cheers
                  David
                  --
                  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
                Your message has been successfully submitted and would be delivered to recipients shortly.