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

Bram: Any explanation for that? - Re: How can I force no undo during a function call?

Expand Messages
  • Bram Moolenaar
    ... It s not so mysterious: changing undolevels only has effect for the next thing being saved for undo. If you are performing a sequence of commands
    Message 1 of 2 , Aug 1, 2002
      Mario Schweigler wrote:

      > The thing is that it works sometimes, but not always, depending on
      > whether I have changed the text before calling the function. Just as you
      > described it, it works fine, but if you change something in the text
      > before calling the function, sometimes (depending on WHERE in the text I
      > change something) it does not work. In this case, "u" would undo
      > everything the function did PLUS the last change before the function.

      It's not so mysterious: changing 'undolevels' only has effect for the
      next thing being saved for undo. If you are performing a sequence of
      commands without typing, this is counted as one undo-able action. You
      can't really switch off undo halfway. However, if you attempt undoing
      halfway the action, this counts as restarting undo and then the value of
      'undolevels' is checked. But since you don't really want to undo
      anything you make it complicated to get back what you want.

      Best is if you can set 'undolevels' to -1 before making any change.
      Changing 'undolevels' halfway a change has unpredictable results.

      --
      From "know your smileys":
      :q vi user saying, "How do I get out of this damn emacs editor?"

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
      \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
      \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.