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 -- -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/af58da67-ab03-410b-81c5-7298ed65adb2n%40googlegroups.com.