On 04-Jan-2012 00:39, Ben Fritz wrote:

> [...]
> I don't notice anything about
> line2byte() in the todo list, so I'm expressing my support again
> either for a new function, or an optional argument to line2byte();
> either telling it to use 'fileencoding' or giving it an encoding to
> use.

+1; the current Vimscript workaround is ugly and inefficient.

I also still would like to get a clarification how "go" / :goto should behave in
this particular case. I would prefer an overloaded :goto! command that uses
'fileencoding' instead of 'encoding' as the base for counting the bytes. This
should be trivial to add after the line2byte() enhancement is done.

On 20-Dec-2011 08:45, Ingo Karkat wrote:

> I'd like to direct the attention also to the related "go" / :goto
> commands. I have rarely used them, but I imagine that the main use
> case is that some external tool is pointing me to a byte offset N in a
> file, and I want to use Vim to quickly check that position. For that
> to work (when &fileencoding differs from &encoding, i.e. what this
> entire discussion is about), Vim would have to use fileencoding-based
> counts. Currently, I would need to use a tool like xxd to achieve that
> goal (assuming I cannot just temporarily switch &encoding, like when
> &fileencoding is ucs-2 or ucs-4).

Bram, shouldn't "go" be based on 'fileencoding' rather than the internal
representation in Vim (in the few cases where there's actually a distinction)?
Can you please give your blessing to a line2byte() / :goto enhancement and put
it into the todo list, so that this eventually gets implemented?

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

Raspunde prin e-mail lui