On Aug 23, 2013 1:07 AM, "Bram Moolenaar" <b...@moolenaar.net> wrote:
>
>
> Nikolay Pavlov wrote:
>
> > On Aug 22, 2013 8:05 PM, "Christian Brabandt" <cbli...@256bit.org>
wrote:
> > >
> > > On Thu, August 22, 2013 17:23, Bram Moolenaar wrote:
> > > > Christian Brabandt wrote:
> > > >> On Mo, 19 Aug 2013, Christian Brabandt wrote:
> > > >>
> > > >> > May be another optional parameter to the setpos() function, that
> > > >> > if given specifies the desired cursor position?
> > > >>
> > > >> Like the attached patch does.
> > > >
> > > > Hmm, I wonder if the extra list elements are going to cause a
problem in
> > > > some existing script.
> > >
> > > I don't think, it will make a difference for the optional
list-argument
> > > of the setpos() call. It might only make a difference for the list
> > > returned by the getpos() call now having 5 elements. If you're worried
> > > about that, simply let getpos('.') always return 4 elements (though
> > > this makes it harder to determine the prefered column).
> >
> > I bet there is a bunch of scripts using 4-variable lets. Simple grep
over
> > the mess in $HOME/.vam (I hold all but my plugins there) found at least
> > LaTeX_box plugin (ftplugin/latex-box/common.vim) and python-mode-klen
> > (autoload/pymode/lint.vim, though it should have used line() and not
> > getpos()). I do not know how many plugins do
> >     let pos=getpos('.')
> >     ...
> >     let [a,b,c,d]=pos
> > , use negative indices or something else. Why not use optional argumet
to
> > getpos() then? Note: optional argument should make it return a
dictionary.
> > 5 indistinguishable  numbers are way too much.
> >
> > Also check out winsaveview(), particularly .curswant key. Maybe there
is no
> > need to modify getpos().
>
> Yes, in complicated cases winsaveview() can be used.
>
> I think that in most cases the original problem applies: setpos() does
> not set the curswant position.  I think the best way to fix this is by
> adding a separate set_curswant() function.  Without argument it uses the
> current cursor position, and otherwise it sets the position to a column
> number.

I think that winrestview() should be officially allowed to accept custom
dictionary:

    call winrestview({'curswant': 3})

seems to work fine. No "If you have changed the values the result is
unpredictable.", but say what can be set this way and what combinations of
keys should not be used.

> --
> FIXME and XXX are two common keywords used to mark broken or incomplete
code
> not only since XXX as a sex reference would grab everybody's attention but
> simply due to the fact that Vim would highlight these words.
>                                         -- Hendrik Scholz
>
>  /// Bram Moolenaar -- b...@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_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui