Hi I noticed that it's possible to use a :for loop on a blob and it's currently not documented:
:for v in 0z0102003 | echo v | endfor 1 2 3 So it apparently behaves like: :for v in [0x01,0x02,0x03] | echo v | endfor 1 2 3 I wanted to document it, but then I then realized that it does not behaves as I'd expect in this example: echo "For loop with list" let l = [1, 2, 3] for x in l echo l call remove(l, 0) endfor echo l echo "For loop with blob" let b = 0z010203 for x in b echo b call remove(b, 0) endfor echo b It outputs: For loop with list [1, 2, 3] [2, 3] [3] [] For loop with blob 0z010203 0z0203 0z03 Notice that: - the loop with list iterated 3 times, as expected, whereas the loop with blob iterated only 2 times which seems wrong. - at the end, list l is empty as expected, whereas blob b has 1 byte left which seems wrong. It looks like a bug to me. But since looping on a blob is not documented, I don't know what to expect. Unrelated question: how do we convert a blob 0z010203 into a list of integers [0x01,0x02,0x03]? Perhaps we should be able to do: :echo items(0z010203) [1,2,3] But that does not work. Any other way? Regards Dominique -- -- 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.
