2015-07-12 17:53 GMT+02:00 Bram Moolenaar <[email protected]>:
>
> Rob Wu wrote:
>
>> The counted number of bytes is decreased if 'bin' and 'noeol' are set.
>> This is incorrect, and the logic should only apply when the requested
>> line is the last line in the buffer.
>>
>> Test cases:
>> vim -b <(printf '123\n567') +':echo line2byte(1)'
>> Expected: 1
>> Actual  : -1
>>
>> vim -b <(printf '123\n567') +':echo line2byte(2)'
>> Expected: 5
>> Actual  : 4
>>
>> vim -b <(printf '123\r\n678') +':echo line2byte(2)'
>> Expected: 6
>> Actual  : 5
>>
>> vim -b <(printf '123\n567') +':echo line2byte(3)'
>> Expected: 9
>> Actual  : 8
>>
>> vim -b <(printf '123\r\n678') +':echo line2byte(3)'
>> Expected: 10 (not 11, because in binary mode fileformat is ignored,
>>               so pressing enter adds a LF and not a CR LF).
>> Actual  : 9
>
> Thanks for the patch. I notice there aren't any tests for line2byte(),
> perhaps someone can create them?

I've added some manual tests to my commit description. You could copy
them and add more tests to avoid regressions. I just started with Vim
scripts last week, so I'm probably not in the best position to write
these tests. Thanks for your fast response!

Kind regards,
 Rob
 https://robwu.nl

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

Raspunde prin e-mail lui