To: vim_dev@googlegroups.com Subject: Patch 7.4.1239 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1239 Problem: JSON message after the first one is dropped. Solution: Put remainder of message back in the queue. Files: src/channel.c *** ../vim-7.4.1238/src/channel.c 2016-02-02 18:19:52.790743971 +0100 --- src/channel.c 2016-02-02 18:37:40.375683988 +0100 *************** *** 567,572 **** --- 567,579 ---- } } } + + /* Put the unread part back into the channel. + * TODO: insert in front */ + if (reader.js_buf[reader.js_used] != NUL) + channel_save(ch_idx, reader.js_buf + reader.js_used, + (int)(reader.js_end - reader.js_buf) - reader.js_used); + vim_free(reader.js_buf); } /* *************** *** 697,704 **** /* * Invoke a callback for channel "idx" if needed. */ ! static void may_invoke_callback(int idx) { char_u *msg = NULL; --- 704,712 ---- /* * Invoke a callback for channel "idx" if needed. + * Return OK when a message was handled, there might be another one. */ ! static int may_invoke_callback(int idx) { char_u *msg = NULL; *************** *** 710,731 **** int json_mode = channels[idx].ch_json_mode; if (channel_peek(idx) == NULL) ! return; if (channels[idx].ch_close_cb != NULL) /* this channel is handled elsewhere (netbeans) */ ! return; if (json_mode) { /* Get any json message. Return if there isn't one. */ channel_read_json(idx); if (channel_get_json(idx, -1, &listtv) == FAIL) ! return; if (listtv->v_type != VAR_LIST) { /* TODO: give error */ clear_tv(listtv); ! return; } list = listtv->vval.v_list; --- 718,739 ---- int json_mode = channels[idx].ch_json_mode; if (channel_peek(idx) == NULL) ! return FALSE; if (channels[idx].ch_close_cb != NULL) /* this channel is handled elsewhere (netbeans) */ ! return FALSE; if (json_mode) { /* Get any json message. Return if there isn't one. */ channel_read_json(idx); if (channel_get_json(idx, -1, &listtv) == FAIL) ! return FALSE; if (listtv->v_type != VAR_LIST) { /* TODO: give error */ clear_tv(listtv); ! return FALSE; } list = listtv->vval.v_list; *************** *** 733,739 **** { /* TODO: give error */ clear_tv(listtv); ! return; } argv[1] = list->lv_first->li_next->li_tv; --- 741,747 ---- { /* TODO: give error */ clear_tv(listtv); ! return FALSE; } argv[1] = list->lv_first->li_next->li_tv; *************** *** 748,761 **** arg3 = &list->lv_last->li_tv; channel_exe_cmd(idx, cmd, &argv[1], arg3); clear_tv(listtv); ! return; } if (typetv->v_type != VAR_NUMBER) { /* TODO: give error */ clear_tv(listtv); ! return; } seq_nr = typetv->vval.v_number; } --- 756,769 ---- arg3 = &list->lv_last->li_tv; channel_exe_cmd(idx, cmd, &argv[1], arg3); clear_tv(listtv); ! return TRUE; } if (typetv->v_type != VAR_NUMBER) { /* TODO: give error */ clear_tv(listtv); ! return FALSE; } seq_nr = typetv->vval.v_number; } *************** *** 785,790 **** --- 793,800 ---- if (listtv != NULL) clear_tv(listtv); vim_free(msg); + + return TRUE; } /* *************** *** 1244,1250 **** int i; for (i = 0; i < channel_count; ++i) ! may_invoke_callback(i); } #endif /* FEAT_CHANNEL */ --- 1254,1261 ---- int i; for (i = 0; i < channel_count; ++i) ! while (may_invoke_callback(i) == OK) ! ; } #endif /* FEAT_CHANNEL */ *** ../vim-7.4.1238/src/version.c 2016-02-02 18:19:52.798743887 +0100 --- src/version.c 2016-02-02 18:41:52.225079033 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 1239, /**/ -- hundred-and-one symptoms of being an internet addict: 106. When told to "go to your room" you inform your parents that you can't...because you were kicked out and banned. /// 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 ///