Hi,
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.
Thanks, Peter