Saturday, August 21, 2010

Ruby $curbuf.number always returns 0 for Vim 7.3 on some platforms

Hi,

I'm the author of the Command-T plug-in, which is a Vim plugin partly
written in Ruby:

https://wincent.com/products/command-t

I've received multiple reports from people on different platforms that
there is breakage running under 7.3 on their platform (I'm afraid I
can't reproduce on Mac OS X though):

https://wincent.com/issues/1617

The apparent cause is that, for them, evaluating "$curbuf.number"
under Ruby _always_ returns 0, when it is supposed to return a
positive integer buffer number. To test, just do this:

:ruby puts $curbuf.number

If you're on an affected platform/Vim, you'll always see 0. Otherwise
you'll see some positive integer.

The plug-in uses the buffer number in a couple of places to select and
close buffers; ie. basically doing stuff like:

:silent b 23

And:

:bwipeout! 23

These users report that a workaround is to use "$curbuf.name" for
those purposes instead. I'm reluctant to make this change to the plug-
in because I'm worried about the possible instability of the buffer
name over time.

So two questions:

(1) is this a known bug in 7.3? (and if not, what information can I
gather from these users to help troubleshoot it)

(2) is using "$curbuf.name" a "safe" workaround, or is it possible
that the value could change over time and introduce unexpected
behavior into the plug-in?

Cheers,
Wincent

--
You received this message from the "vim_use" 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

No comments: