19 декабря 2011 г. 17:03 пользователь Ingo Karkat <[email protected]>написал:

> On 19-Dec-2011 13:35, Дмитрий Франк wrote:
>
> > Citation from help: "Return the *byte count* from the start of the
> buffer for
> > line {lnum}"
> >
> > Returned *byte count* is wrong. It returns character count instead of
> > byte count.
>
> I cannot reproduce this, neither with Vim 7.3.0 on Windows/x64, nor with
> Vim
> 7.3.353 on Linux/x86:
>
> $ vim -N -u NONE --cmd "set enc=utf-8" -c "call setline(1, ['foobaN',
> ''])" -c
> "2|echo line2byte('.')"
> 8
> $ vim -N -u NONE --cmd "set enc=utf-8" -c "call setline(1,
> ['fooba'.nr2char(1049), ''])" -c "2|echo line2byte('.')"
> 9
>
> Please post your Vim version, and steps to reproduce.
>
> -- regards, ingo
>
> PS: Please bottom-post on vim_dev.
>
>
i use Windows, and i have to keep Vim's encoding cp1251. (standard encoding
for russian Windows)

Vim 7.3.46 on Windows/x86

$ vim -N -u NONE --cmd "set enc=cp1251 | set fenc=utf-8 | set ff=unix" -c
"call setline(1,['foobaN', ''])" -c "2|echo line2byte('.')"
8
$ vim -N -u NONE --cmd "set enc=cp1251 | set fenc=utf-8 | set ff=unix" -c
"call setline(1,['fooba'.nr2char(1049), ''])" -c "2|echo line2byte('.')"
8

seems like line2byte() looks on the &encoding , but it should look on the
&fileencoding .

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

Raspunde prin e-mail lui