вторник, 15 мая 2012 г., 1:30:23 UTC+4 пользователь Bram Moolenaar написал:
> ZyX wrote:
> 
> > Any news on the status of the patch?
> 
> It's in the todo list at line 164:
> 
> Patch for Python: add pyeval()(zyx, 2012 Apr 15, update Apr 16)
> Also changes for Lua.  Update Apr 19.  Update Apr 22.
> 
> That's the one, right?

Yes, but rather confusing: main addition is vim.bindeval(), pyeval() is here 
just because it was simple to add it after other changes [1].

By the way, how do you look at adding vim.strwidth() function that calls 
mb_string2cells() directly without doing unneeded binary search and memory 
allocations which will be done in case of using 
"strwidth=vim.bindeval('function("strwidth")')"? You can't really have a nice 
table without using strdisplaywidth() (strwidth() if doing s.replace('\t', '    
') is fine, it should be even faster) and if I want a table with more then 
10000 lines it comes very handy.

[1] While pyeval() is also a great change for new plugins, writing code like

    if hasattr(vim, 'bindeval'):
        return_ = lambda r: vim.bindeval('d').__setitem__('result', r)
    else:
        return_ = lambda r: vim.eval('extend(d, {"result": '+dumps(r)+'}')

to return a value from python function respecting the fact that not all users 
have the most recent vim is much simpler then to construct something that will 
use pyeval() if available and vim.eval() if not.

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

Raspunde prin e-mail lui