Bram Moolenaar wrote:
>> [...]
>>
>> I did some tests with virtcol() and compared the results with my
>> expectations (which may be plain wrong), see also Issue 277.
>> [...]
>
> You are passing in an invalid position, halfway a character, thus the
> returned value is undefined.
Thank you for your answer.
Vim itself passes sometimes invalid positions ("halfway a character") to
getvcol() [that's why I looked at halfway characters]. There is a one
character example in https://github.com/vim/vim/issues/277
─
─────┬────┬──────────┬────┬──────────────────
Ind.│Byte│codepoint │Vcol│ grapheme cluster
─────┼────┼──────────┼────┼──────────────────
00 │ e2 │ U+002500 │ 01 │ ─
01 │ 94 │ │ │
02 │ 80 │ │ │
─────┴────┴──────────┴────┴──────────────────
If I use visual character mode and if I yank this one character and then
ask (where was the yank)
:echo virtcol("']")
then Vim passes (internally) the col=2 (index/Ind.) to getvcol. That's
the reason why the answer (2) of this echo is wrong, because the
character has only one column. And that's why I also looked at halfway
positions.
>
> I don't know why you pass in an invalid position, but it looks like it
> can be made to accept the position by changing f_virtcol() to adjust the
> column to the start of the character. Changing getvcol() is probably a
> bad idea.
>
If getvol() should not be changed, then one has to look, why vim itself
is sometimes passing "wrong" byte-positions ...
Bye
C. Ludwig
--
--
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.