forked from aniani/vim
patch 7.4.1239
Problem: JSON message after the first one is dropped. Solution: Put remainder of message back in the queue.
This commit is contained in:
@@ -567,6 +567,13 @@ channel_read_json(int ch_idx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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,8 +704,9 @@ channel_exe_cmd(int idx, char_u *cmd, typval_T *arg2, typval_T *arg3)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Invoke a callback for channel "idx" if needed.
|
* Invoke a callback for channel "idx" if needed.
|
||||||
|
* Return OK when a message was handled, there might be another one.
|
||||||
*/
|
*/
|
||||||
static void
|
static int
|
||||||
may_invoke_callback(int idx)
|
may_invoke_callback(int idx)
|
||||||
{
|
{
|
||||||
char_u *msg = NULL;
|
char_u *msg = NULL;
|
||||||
@@ -710,22 +718,22 @@ may_invoke_callback(int idx)
|
|||||||
int json_mode = channels[idx].ch_json_mode;
|
int json_mode = channels[idx].ch_json_mode;
|
||||||
|
|
||||||
if (channel_peek(idx) == NULL)
|
if (channel_peek(idx) == NULL)
|
||||||
return;
|
return FALSE;
|
||||||
if (channels[idx].ch_close_cb != NULL)
|
if (channels[idx].ch_close_cb != NULL)
|
||||||
/* this channel is handled elsewhere (netbeans) */
|
/* this channel is handled elsewhere (netbeans) */
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
if (json_mode)
|
if (json_mode)
|
||||||
{
|
{
|
||||||
/* Get any json message. Return if there isn't one. */
|
/* Get any json message. Return if there isn't one. */
|
||||||
channel_read_json(idx);
|
channel_read_json(idx);
|
||||||
if (channel_get_json(idx, -1, &listtv) == FAIL)
|
if (channel_get_json(idx, -1, &listtv) == FAIL)
|
||||||
return;
|
return FALSE;
|
||||||
if (listtv->v_type != VAR_LIST)
|
if (listtv->v_type != VAR_LIST)
|
||||||
{
|
{
|
||||||
/* TODO: give error */
|
/* TODO: give error */
|
||||||
clear_tv(listtv);
|
clear_tv(listtv);
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
list = listtv->vval.v_list;
|
list = listtv->vval.v_list;
|
||||||
@@ -733,7 +741,7 @@ may_invoke_callback(int idx)
|
|||||||
{
|
{
|
||||||
/* TODO: give error */
|
/* TODO: give error */
|
||||||
clear_tv(listtv);
|
clear_tv(listtv);
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
argv[1] = list->lv_first->li_next->li_tv;
|
argv[1] = list->lv_first->li_next->li_tv;
|
||||||
@@ -748,14 +756,14 @@ may_invoke_callback(int idx)
|
|||||||
arg3 = &list->lv_last->li_tv;
|
arg3 = &list->lv_last->li_tv;
|
||||||
channel_exe_cmd(idx, cmd, &argv[1], arg3);
|
channel_exe_cmd(idx, cmd, &argv[1], arg3);
|
||||||
clear_tv(listtv);
|
clear_tv(listtv);
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typetv->v_type != VAR_NUMBER)
|
if (typetv->v_type != VAR_NUMBER)
|
||||||
{
|
{
|
||||||
/* TODO: give error */
|
/* TODO: give error */
|
||||||
clear_tv(listtv);
|
clear_tv(listtv);
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
seq_nr = typetv->vval.v_number;
|
seq_nr = typetv->vval.v_number;
|
||||||
}
|
}
|
||||||
@@ -785,6 +793,8 @@ may_invoke_callback(int idx)
|
|||||||
if (listtv != NULL)
|
if (listtv != NULL)
|
||||||
clear_tv(listtv);
|
clear_tv(listtv);
|
||||||
vim_free(msg);
|
vim_free(msg);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1244,7 +1254,8 @@ channel_parse_messages(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < channel_count; ++i)
|
for (i = 0; i < channel_count; ++i)
|
||||||
may_invoke_callback(i);
|
while (may_invoke_callback(i) == OK)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FEAT_CHANNEL */
|
#endif /* FEAT_CHANNEL */
|
||||||
|
@@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1239,
|
||||||
/**/
|
/**/
|
||||||
1238,
|
1238,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user