Hi Peter,
On Mo, 10 Jun 2024, Peter Aronoff wrote:
> Over the weekend, I wrote a script using getpos() to copy (and
> eventually replace) the current visual selection, but I was initially
> confused by the documentation. I'm considering submitting a patch to
> clarify what I didn't understand, but I want to ask here because maybe
> there's material I didn't see (or misunderstood).
>
> The help for getpos() points to line() to explain the position
> argument that you pass to getpos(). I think that the docs for line()
> can be clearer about the relationship between '.' and 'v' in the
> context of a visual selection. The docs for line() say that '.' is
> "the cursor position" and that 'v', in visual mode, is "the start of
> the Visual area (the cursor is the end)." However, since the user (or
> a script or mapping) can move the cursor from one end of the visual
> selection, this isn't quite true (I think). It seems more accurate to
> say that in visual mode '.' is the position of the cursor and 'v' is
> the other endpoint. This can matter if a script assumes that the
> return value of getpos('.') is *the end* of a visual selection and the
> return value of getpos('v') is *the start*. If the cursor is at the
> start of the visual selection, these return values will be reversed (I
> think).
>
> Would it make sense to update the docs for line()? I'm happy to submit
> a patch, but if I'm just confused, please let me know.
I agree, I have been confused by that documentation as well before. So a
doc patch is definitely welcome.
Thanks,
Christian
--
Conference, n.:
A special meeting in which the boss gathers subordinates to hear
what they have to say, so long as it doesn't conflict with what
he's already decided to do.
--
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/Zmcj4l3yxOwoje89%40256bit.org.