To: vim_dev@googlegroups.com Subject: Patch 7.4.2287 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2287 Problem: The callback passed to ch_sendraw() is not used. Solution: Pass the read part, not the send part. (haya14busa, closes #1019) Files: src/channel.c, src/testdir/test_channel.vim *** ../vim-7.4.2286/src/channel.c 2016-08-26 17:58:33.586124416 +0200 --- src/channel.c 2016-08-28 19:23:44.025605252 +0200 *************** *** 3456,3462 **** EMSG2(_("E917: Cannot use a callback with %s()"), fun); return NULL; } ! channel_set_req_callback(channel, part_send, opt->jo_callback, opt->jo_partial, id); } --- 3456,3462 ---- EMSG2(_("E917: Cannot use a callback with %s()"), fun); return NULL; } ! channel_set_req_callback(channel, *part_read, opt->jo_callback, opt->jo_partial, id); } *** ../vim-7.4.2286/src/testdir/test_channel.vim 2016-08-27 19:21:43.133981447 +0200 --- src/testdir/test_channel.vim 2016-08-28 19:20:27.215278334 +0200 *************** *** 245,251 **** """"""""" - let g:Ch_reply = "" func Ch_handler(chan, msg) unlet g:Ch_reply let g:Ch_reply = a:msg --- 245,250 ---- *************** *** 271,278 **** --- 270,279 ---- func Test_channel_handler() call ch_log('Test_channel_handler()') + let g:Ch_reply = "" let s:chopt.callback = 'Ch_handler' call s:run_server('Ch_channel_handler') + let g:Ch_reply = "" let s:chopt.callback = function('Ch_handler') call s:run_server('Ch_channel_handler') unlet s:chopt.callback *************** *** 443,448 **** --- 444,454 ---- let msg = ch_readraw(job) call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g')) + let g:Ch_reply = "" + call ch_sendraw(job, "double this\n", {'callback': 'Ch_handler'}) + call WaitFor('"" != g:Ch_reply') + call assert_equal("this\nAND this\n", substitute(g:Ch_reply, "\r", "", 'g')) + let reply = ch_evalraw(job, "quit\n", {'timeout': 100}) call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g')) finally *** ../vim-7.4.2286/src/version.c 2016-08-28 18:47:10.772482802 +0200 --- src/version.c 2016-08-28 19:26:20.392275471 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2287, /**/ -- From "know your smileys": |-( Contact lenses, but has lost them /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///