On 8/31/06, Thomas <[EMAIL PROTECTED]> wrote:
> This is wrong. You need:
> let col = col(".")
> let line = strpart(getline("."), col - 1)
Unfortunately, IIRC this doesn't work with wrapped lines which is why I
chose virtcol() ... But, well can't reproduce what I did (or thought
that I did) 10 minutes ago. Anyway, it doesn't work with enc=utf8
Yes it does. Take simple example, Create line with 1 high utf-8 char
entering Ctrl-Vu1234 then a. Put cursor on 2nd character, on 'a'. (I
assume :set enc=utf-8).
Try
:echo col('a')
You'll see that it prints 4 not 2.
It properly account for width of utf-8 characters!
From :help col():
col({expr}) The result is a Number, which is the byte index of the column
position given with {expr}.
Yakov