Aaron Bohannon wrote:

> Consider this line of text: "abc def".  If the cursor is on "d" and
> you type "Dix<esc>" in normal mode, the result will depend on the
> value of 'virtualedit'.
> 
> * when ve="", you get "abcx "
> * when ve="onemore", you get "abc x"
> * when ve="all", you get "abc x"
> 
> You will find that you get the same results if you define this
> function and call it:
> 
> function Foo()
>   execute "normal! Dix\e"
> endfunction
> 
> Now consider these two variations:
> 
> function Foo1()
>   set ve=onemore
>   execute "normal! Dix\e"
> endfunction
> 
> function Foo2()
>   set ve=all
>   execute "normal! Dix\e"
> endfunction
> 
> If you begin with ve="" and try calling these functions, you will be 
> surprised:
> 
> * with Foo1, you get "abc x"
> * with Foo2, you get "abcx "
> 
> This really threw me for a loop -- it took me forever to figure out
> why my script wasn't working this morning.  Is this behavior
> intentional or should I submit a bug?

I cannot reproduce this, for me Foo2() has the same result as Foo1().
I suggest you check where you cursor is when you call the function.

-- 
Vi is clearly superior to emacs, since "vi" has only two characters
(and two keystrokes), while "emacs" has five.  (Randy C. Ford)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to