Wednesday, March 28, 2012

Re: buggy behavior when changing 'virtualedit' inside scripts?

Aaron Bohannon wrote:

> I apologize. I couldn't reproduce my problem either...because I
> apparently left out a critical piece when condensing my much larger
> example. The real problem seems to also involve 'opfunc'. If you
> source the following function definitions and mappings, you will see
> that -$ and +$ inexplicably behave differently.
>
> I tested it on Vim 7.3 (with patches 1-244,246-462) on OS X (10.7) and
> Vim 7.3 (with patches 1-62) on Linux (kernel 2.6). In both cases, I
> ran vim in a terminal, using the command line "vim -u NONE -NX".
>
> - Aaron
>
> ----
> function Foo1(type)
> set ve=onemore
> silent execute "normal! `[v`]dix\e"
> set ve=
> endfunction
>
> function Foo2(type)
> set ve=all
> silent execute "normal! `[v`]dix\e"
> set ve=
> endfunction
>
> nmap - :set opfunc=Foo1<cr>g@
> nmap + :set opfunc=Foo2<cr>g@
> ----

Still can't reproduce it, both -$ and +$ do the same thing. Oh wait,
the -X argument is essential. Weird.

OK, I tracked it down. I'll send out a patch. A workaround is to set
'virtualedit' to "all,onemore" instead of "all".

--
hundred-and-one symptoms of being an internet addict:
269. You receive an e-mail from the wife of a deceased president, offering
to send you twenty million dollar, and you are not even surprised.

/// Bram Moolenaar -- Bram@Moolenaar.net -- 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

No comments: