On 1 July 2014, Павлов Николай Александрович
<[email protected]> wrote:
> On July 1, 2014 9:54:00 PM GMT+03:00, LCD 47 <[email protected]> wrote:
[...]
> >    The problem with virtcol() (and most similar functions, for that
> >matter) is that it isn't independent of the surrounding context.  It
> >requires either the cursor, or a mark to be set to the position
>
>  virtcol() does accept lists (line and column pairs).

    Well, somehow I managed to overlook this for years.  Thank you for
enlightening me, I suppose I'm too old to be allowed around Vim code
these days.

> >you care about.  In a script this is horribly intrusive: I have to
> >save either the cursor or a mark, set things up for virtcol(), find
> >out the position, then restore the cursor or mark.  I just want to
> >convert between screen columns and byte offsets, dammit!  It's a
> >length
>
> virtcol([linenr, col]) will do. The opposite conversion (screen column
> to byte index) is much more complicated.

    Of course, you're right: virtcol() is useless in the context of the
initial discussion, you need to convert coordinates the other way around
to translate a '\%...v' for matchaddpos().

> >calculation, why on Earth should I care where the cursor and / or the
> >marks are?
>
> You should not care. You should read documentation.

    You think so?  After all, I managed to find out about the cursor and
marks using my ESP abilities. ;)

    /lcd

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui