On 28-May-2014 14:35 +0200, Bram Moolenaar wrote:

> Patch 7.4.310
> Problem:    getpos()/setpos() don't include curswant.
> Solution:   Add a fifth number when getting/setting the cursor.
> Files:            src/eval.c, src/testdir/test_eval.in, 
> src/testdir/test_eval.ok,
>           runtime/doc/eval.txt

Nice addition, though I currently can't think of a situation where I
would actively set {curswant} to a particular column. Rather, I want my
plugins to set {curswant} when positioning the cursor (what I learned is
done by calling plain cursor(), but not plain getpos('.')). I think that
crucial distinction should be added to the help:

diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2620,6 +2620,10 @@ cursor({list})
                When 'virtualedit' is used {off} specifies the offset in
                screen columns from the start of the character.  E.g., a
                position within a <Tab> or after the last character.
+               When {curswant} is omitted, the preferred column is set to
+               {col}, so cursor() behaves like a normal motion (unlike
+               setpos('.', [...]), where {curswant} needs to be present to do
+               this).
                Returns 0 when the position could be set, -1 otherwise.

This assumes that the patch doesn't change the previous behavior of
:call cursor(2,3) and that :call cursor([2,3,0]) behaves the same; I
haven't tested that.

-- regards, ingo

-- 
-- 
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