virtualedit cursor() wrong positionning, bug or feature ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

virtualedit cursor() wrong positionning, bug or feature ?

Sylvain Viart
Hi,

> VIM - Vi IMproved 6.3 (2004 June 7, compiled May 20 2005 19:14:18)
> Included patches: 1-72


When I do in ex mode

he cursor
set ve=all
call cursor(1199, 12)
echo wincol()
" wrong = 26

But if I use vim motion I get the expected result
 
exe "norm ".1199."G".12."|"
echo wincol()
" OK good = 12

I want the second result. What I can do the old way ;-) .
But I wanted to test it with the cursor() function, expecting more
absolute positioning.

Seems that something is missing about th virtualediting in the cursor()
function or its doc.

Regards,
Sylvain.

Reply | Threaded
Open this post in threaded view
|

Re: virtualedit cursor() wrong positionning, bug or feature ?

Bram Moolenaar

Sylvain Viart wrote:

> > VIM - Vi IMproved 6.3 (2004 June 7, compiled May 20 2005 19:14:18)
> > Included patches: 1-72
>
> When I do in ex mode
>
> he cursor
> set ve=all
> call cursor(1199, 12)
> echo wincol()
> " wrong = 26
>
> But if I use vim motion I get the expected result
>  
> exe "norm ".1199."G".12."|"
> echo wincol()
> " OK good = 12
>
> I want the second result. What I can do the old way ;-) .
> But I wanted to test it with the cursor() function, expecting more
> absolute positioning.
>
> Seems that something is missing about th virtualediting in the cursor()
> function or its doc.

You put the cursor in a byte column and get the position as a screen
column.  When there are characters that are more then one screen
position the numbers will be different.  Tabs in this example.
The "|" command moves to a screen column.

--
I AM THANKFUL...
...for the mess to clean after a party because it means I have
been surrounded by friends.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///