Skip to content

Commit

Permalink
patch 7.4.2287
Browse files Browse the repository at this point in the history
Problem:    The callback passed to ch_sendraw() is not used.
Solution:   Pass the read part, not the send part. (haya14busa, closes vim#1019)
  • Loading branch information
brammool committed Aug 28, 2016
1 parent fec246d commit 6fc8227
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -3456,7 +3456,7 @@ send_common(
EMSG2(_("E917: Cannot use a callback with %s()"), fun);
return NULL;
}
channel_set_req_callback(channel, part_send,
channel_set_req_callback(channel, *part_read,
opt->jo_callback, opt->jo_partial, id);
}

Expand Down
8 changes: 7 additions & 1 deletion src/testdir/test_channel.vim
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ endfunc

"""""""""

let g:Ch_reply = ""
func Ch_handler(chan, msg)
unlet g:Ch_reply
let g:Ch_reply = a:msg
Expand All @@ -271,8 +270,10 @@ endfunc

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
Expand Down Expand Up @@ -443,6 +444,11 @@ func Test_raw_pipe()
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
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2287,
/**/
2286,
/**/
Expand Down

0 comments on commit 6fc8227

Please sign in to comment.