Patch 7.1.147
Patch 7.1.147 (after 7.1.127) Problem:Freeing memory already freed when completing user name. (Meino Cramer) Solution: Use a flag to remember if orig needs to be freed. Files: src/ex_getln.c *** ../vim-7.1.146/src/ex_getln.c Sun Sep 30 22:10:45 2007 --- src/ex_getln.c Tue Oct 30 17:13:33 2007 *** *** 3353,3358 --- 3353,3359 char_u*ss = NULL; static intfindex; static char_u *orig_save = NULL; /* kept value of orig */ + int orig_saved = FALSE; int i; long_ulen; int non_suf_match; /* number without matching suffix */ *** *** 3421,3426 --- 3422,3428 { vim_free(orig_save); orig_save = orig; + orig_saved = TRUE; /* * Do the expansion. *** *** 3546,3552 ExpandCleanup(xp); /* Free orig if it wasn't stored in orig_save. */ ! if (orig != orig_save) vim_free(orig); return ss; --- 3548,3554 ExpandCleanup(xp); /* Free orig if it wasn't stored in orig_save. */ ! if (!orig_saved) vim_free(orig); return ss; *** ../vim-7.1.146/src/version.cMon Oct 29 22:37:57 2007 --- src/version.c Tue Oct 30 17:30:35 2007 *** *** 668,669 --- 668,671 { /* Add new patch number below this line */ + /**/ + 147, /**/ -- hundred-and-one symptoms of being an internet addict: 59. Your wife says communication is important in a marriage...so you buy another computer and install a second phone line so the two of you can chat. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Python unit tests
I've updated the Win64 port. By far the biggest change is that the Python interface is now supported. That required some substantial changes to the code to use Py_ssize_t: see http://docs.python.org/whatsnew/pep-353.html You can read more about some of the issues that I had at http://mail.python.org/pipermail/capi-sig/2007-October/thread.html My biggest problem with testing the Python stuff is that there are no good tests. About the best that I found is http://www.whisperingwind.co.uk/vimproject/, which doesn't actually work properly on Windows anyway. I searched vim.org for Python, but I didn't find anything compelling. Does anyone have some Vim/Python code that exercises the Python interface well; e.g., uses vim.buffers, vim.windows, vim.command, etc? You can find my patch at http://www.georgevreilly.com/vim/vim-win64-20071028.zip. I need to test this with a few more compilers before I'm happy with it. -- /George V. Reilly http://www.georgevreilly.com/blog --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Operator pending mode
On Oct 30, 1:38 pm, Bram Moolenaar [EMAIL PROTECTED] wrote: Ben Schmidt wrote: 3. Don't know about v:operator (works for me), the showcmd option means it could also be v:command or v:operatorcommand (since there is ... I'm not quite convinced adding v:operator is useful. What would help is giving a couple of examples how it's used. Also, in the docs for v:operator it would be good to have a few examples of the values. I suppose it can be one char, like d, but also something longer. How about the count, e.g., when I do 4d? Here is a simple example: function! MyOp(op) let cmd = a:op echo 'v:count:' v:count 'v:register:' v:register 'v:operator' v:operator 'you pressed:' cmd exec normal! . \ ((v:count 0)?(v:count):''). \ (v:register==''?'':''.v:register). \ v:operator. \ cmd endfunction omap w :call MyOp('w')CR omap e :call MyOp('e')CR omap $ :call MyOp('$')CR If you type the following commands: c$ 2yw a3de You will get the following output: v:count: 0 v:register: v:operator c you pressed: $ v:count: 2 v:register: v:operator y you pressed: w v:count: 3 v:register: a v:operator d you pressed: e What this provides is all the information to capture what the user pressed which Vim does not currently support. In the YankRing case, I will be able to replay what the user typed and still manage to capture the registers. This is very useful for me, but I suspect other plugin developers will also benefit since they can make smarter functions by looking at what the user has keyed in. Dave --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Operator pending mode
On 10/30/07, Bram Moolenaar [EMAIL PROTECTED] wrote: David Fishburn wrote: On Oct 30, 1:38 pm, Bram Moolenaar [EMAIL PROTECTED] wrote: Ben Schmidt wrote: 3. Don't know about v:operator (works for me), the showcmd option means it could also be v:command or v:operatorcommand (since there is ... I'm not quite convinced adding v:operator is useful. What would help is giving a couple of examples how it's used. Also, in the docs for v:operator it would be good to have a few examples of the values. I suppose it can be one char, like d, but also something longer. How about the count, e.g., when I do 4d? Here is a simple example: function! MyOp(op) let cmd = a:op echo 'v:count:' v:count 'v:register:' v:register 'v:operator' v:operator 'you pressed:' cmd exec normal! . \ ((v:count 0)?(v:count):''). \ (v:register==''?'':''.v:register). \ v:operator. \ cmd endfunction omap w :call MyOp('w')CR omap e :call MyOp('e')CR omap $ :call MyOp('$')CR If you type the following commands: c$ 2yw a3de You will get the following output: v:count: 0 v:register: v:operator c you pressed: $ v:count: 2 v:register: v:operator y you pressed: w v:count: 3 v:register: a v:operator d you pressed: e What this provides is all the information to capture what the user pressed which Vim does not currently support. In the YankRing case, I will be able to replay what the user typed and still manage to capture the registers. This is very useful for me, but I suspect other plugin developers will also benefit since they can make smarter functions by looking at what the user has keyed in. Well, I can see that you get the information, but this is not really a useful real-world example. Think of a user that wants to get something done for which v:operator is needed. And for which there is no other solution. This is as real as it gets, using omaps there is no other solution that I or this list could find. The echo was just an FYI to the user, but my function is replaying the command the user typed so that I can later act on the effects of the command: exec normal! . \ ((v:count 0)?(v:count):''). \ (v:register==''?'':''.v:register). \ v:operator. \ cmd Without v:operator, anyone who is writing an omap is hamstrung. omap lets me define (or redefine) a motion. But without the context of the command (in this case I don't know whether the user is yanking, deleting or changing). Vim provides all the other information except this one piece of critical data (basically the same thing showcmd displays in the statusline). omaps can be much more useful than they currently are. In my real world plugin I will be creating an omap for every motion Vim supports. That way I have the opporunity to record changes made by Vim and the user. The YankRing is missing a lot of functionality at the moment since I cannot support change commands (and quite a few others) but omaps can provide the missing link, but they are essentially useless without providing the intent of the user. c,d,y provides that context. Dave --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Operator pending mode
Well, I can see that you get the information, but this is not really a useful real-world example. Think of a user that wants to get something done for which v:operator is needed. And for which there is no other solution. Here's a somewhat naively implemented example where a custom text-object is defined that allows you to operate on a function name whether the cursor is on the name itself or on its arguments. You can yank with yF, change with cF, uppercase with gUF, etc. I can't think of any other way to do this, or more complicated language-based custom text-object definition--e.g. yank/change a whole conjunction or disjunction in a logic language, yank or change the condition of an 'if' or 'while' loop from anywhere within its body. Some of these would be more useful than others, of course, but there are a lot of real world possibilities, I think. Ben. :onoremap F Esc:call OperateFunctionName()CR function! OperateFunctionName() let last_count = v:count let last_op = v:operator let last_reg = v:register exe normal \Esc while search('\(\%#\i\|\i\s*\%#\)\i*\s*(','ce',line('.')+1) == 0 normal [( endwhile exe normal \BS\_yiw echo 'normal '.(last_count0?(last_count):'').''.last_reg.last_op.'e' endfun Send instant messages to your online friends http://au.messenger.yahoo.com --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Reproducible SEGV when deleting over BOL using i_CTRL-o
To reproduce, do the following in a newly started vim: First enable 'h' moving between lines to give us a way to delete over BOL, though left would work if you're using gvim :set ww=h then, ixCRC-odh that is, insert a line containing x, then try to delete over BOL without leaving insert mode from the next line. x can be replaced with any string, though not an empty line. Vim comes back with: E341: Internal error: lalloc(0, ) cannot yank; delete anyway (y/n)? Which is bad enough, but if you say 'n' at the prompt, press enter to dismiss the new prompt (E470: Command aborted Press ENTER or type command to continue), then type 2 more characters as though you're still happily in insert mode, vim will SEGV because it screwed up it's internal idea of where the cursor is. This seems to be because both coladvance and nv_left increment the cursor column, resulting in an off-by-one error that eventually leads to yank_copy_line believing that no characters were affected and trying to allocate 0 space for the 0 characters (thus the E341). So, the fix seems to be that nv_left should only increment the cursor column if coladvance (or, more accurately, getvpos) has not already moved it. The following patch fixes it, but Bram or someone else more familiar with the codebase might well be able to suggest a better way. ~Matt Index: src/normal.c === --- src/normal.c(revision 625) +++ src/normal.c(working copy) @@ -5854,7 +5854,9 @@ || cap-oap-op_type == OP_CHANGE) !lineempty(curwin-w_cursor.lnum)) { - ++curwin-w_cursor.col; + /* Only if not already handled by coladvance */ + if(restart_edit == NUL) + ++curwin-w_cursor.col; cap-retval |= CA_NO_ADJ_OP_END; } continue; --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: (2, actually 3) Operator pending mode
Well, I can see that you get the information, but this is not really a useful real-world example. Think of a user that wants to get something done for which v:operator is needed. And for which there is no other solution. Here's a somewhat naively implemented example where a custom text-object is defined that allows you to operate on a function name whether the cursor is on the name itself or on its arguments. You can yank with yF, change with cF, uppercase with gUF, etc. I can't think of any other way to do this, or more complicated language-based custom text-object definition--e.g. yank/change a whole conjunction or disjunction in a logic language, yank or change the condition of an 'if' or 'while' loop from anywhere within its body. Some of these would be more useful than others, of course, but there are a lot of real world possibilities, I think. A better one: :onoremap F Esc:call OperateFunctionName()CR :function! OperateFunctionName() : let save_count = v:count : let save_op = v:operator : let save_reg = v:register : while search('\(\%#\i\|\i\s*\%#\)\i*\s*(','ce',line('.')+1) == 0 :if searchpair('(','',')','bW') == 0 : normal \Esc : return :endif : endwhile : exe normal \BS\_yiw : exe 'normal '.save_reg.(save_count0?(save_count):'').save_op.'e' :endfun Send instant messages to your online friends http://au.messenger.yahoo.com --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: (2) Operator pending mode
[CCing this to the mailing lists; only went to Bram before, but some parts may be useful for others.] I'm not quite convinced adding v:operator is useful. What would help is giving a couple of examples how it's used. Also, in the docs for v:operator it would be good to have a few examples of the values. I suppose it can be one char, like d, but also something longer. How about the count, e.g., when I do 4d? Very happy to modify the patch to document this. It does not include the count; that is what v:count is for. And it will be two characters for commands that begin with 'g' or 'z', and one character otherwise. Happy to include an example or two as well. I emailed a candidate a few moments ago. Interested to hear what people think, and will do so before revising the patch. My gut feeling regarding this, though, would be that if people want to use this, they will know how they want to use it, so an example isn't really necessary and would probably add more clutter to the docs than insight. Still, as I said, I'm very happy to put one in the patch! Ben. Send instant messages to your online friends http://au.messenger.yahoo.com --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---