On 12/30/2019 7:05 PM, Tony Mechelynck wrote:
On Tue, Dec 31, 2019 at 3:48 AM Ernie Rael <[email protected]> wrote:
On 12/30/2019 6:42 PM, Tony Mechelynck wrote:
On Tue, Dec 31, 2019 at 3:31 AM Ernie Rael <[email protected]> wrote:
On 12/29/2019 6:11 PM, Ernie Rael wrote:root
From python, is it *always* true that "vim.buffer[i].number == i" ?
-ernie
I've convinced myself that this is true. The docs say
A mapping object providing access to the list of vim buffers.
...
b.number Buffer number. Can be used as |python-buffers| key.
and the python interface code uses
b = buflist_findnr((int) bnr);
-ernie
To test if it is really _always_ true, test it with invalid values,
for instance -1 or 9999.
Best regards,
Tony.
I used bwipe as well as some plain invalid numbers. Invalid numbers
generate errors from vim, so the test couldn't complete; the function
wouldn't collapse and I guess it's both true and false :-)
-ernie
In that case I guess you could put that statement inside a Python
try..except construct and catch the appropriate vim.error
Best regards,
Tony.
It's true enough (much better than a politician) for my needs. I'm
working through a bug in some plugin code, Splice - it turns vim into a
great merge tool. There's a variety of stuff that can be simplified by
using the buffer.number for what it is.
Thanks Tony,
-ernie
--
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/7c925811-52a1-b0ee-f99d-40b08524f8f3%40raelity.com.