On Dec 19, 8:04 am, Ingo Karkat <[email protected]> wrote: > > This raises the question how line2byte() (and go/:goto commands) should > behave. > I would side with you, using byte counts of the file, not the internal > representation (especially because for all Unicode encodings, Vim internally > uses UTF-8, so it wouldn't be possible to jump to UTF-16 / UTF-32 offsets even > by setting 'encoding' to it). > > :help line2byte() indirectly supports this (*emphasis* mine): > > > This can also be used to get the byte count for the line just > > below the last line: > > > line2byte(line("$") + 1) > > *This is the file size plus one.* > > I think this issue needs at least a note in the documentation, and I wonder > whether it's feasible to implement in the way you suggest. (For maximum > flexibility, line2byte() could take an optional flag whether file- or > internal-offset is wanted.) >
I'd support adding an optional encoding flag to line2byte() and other functions. Actually the ones that have bugged me the most are readfile() and writefile(). I have a note to myself listing system() as well for this but I cannot recall why I thought it was needed there. -- 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
