Re: Steve Losh's Splice plugin fails with Vim 7.4
- On 2013-08-22, Nikolay Pavlov wrote:
> No, this is not a bug. Index of buffer within vim.buffers used to be an unknownThank you! That works great. I applied your change right away,
> integer: it was index of underlying C linked list of buffers. I changed the
> code to make it more meaningful: now this index is buffer number. But there is
> no buffer number zero.
> Guess it was better to make it more like vim.windows for such cases (index in
> vim.windows is window number-1). To get first buffer regardless of what vim
> version is one has to use next(iter(vim.buffers)).
> Note that the following code (it is the one that raises an exception) is
> incorrect in any vim:
> class Buffer(object):
> def __init__(self, i):
> self.number = i + 1
> self._buffer = vim.buffers[i]
> self.name = self._buffer.name
> : buffer number was NEVER equal to buffer index in vim.buffers incremented by
> 1. It may be eventually equal, but only until you delete some buffer that was
> created earlier then the buffer you seek. To make it work correctly before and
> after my change one should write
> for b in vim.buffers:
> if b.number == self.number:
> self._buffer = b
> in place of the second line in __init__.
then had to wait for an opportunity to test it.
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 vim_dev+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.