0
0
mirror of https://github.com/vim/vim.git synced 2025-10-17 07:44:28 -04:00

patch 7.4.2258

Problem:    Two JSON messages are sent without a separator.
Solution:   Separate messages with a NL. (closes #1001)
This commit is contained in:
Bram Moolenaar
2016-08-26 17:58:53 +02:00
parent 9f28953f0c
commit f1f0792e55
7 changed files with 53 additions and 18 deletions

View File

@@ -2165,7 +2165,7 @@ channel_exe_cmd(channel_T *channel, int part, typval_T *argv)
int id = argv[id_idx].vval.v_number;
if (tv != NULL)
json = json_encode_nr_expr(id, tv, options);
json = json_encode_nr_expr(id, tv, options | JSON_NL);
if (tv == NULL || (json != NULL && *json == NUL))
{
/* If evaluation failed or the result can't be encoded
@@ -2175,7 +2175,7 @@ channel_exe_cmd(channel_T *channel, int part, typval_T *argv)
err_tv.v_type = VAR_STRING;
err_tv.vval.v_string = (char_u *)"ERROR";
tv = &err_tv;
json = json_encode_nr_expr(id, tv, options);
json = json_encode_nr_expr(id, tv, options | JSON_NL);
}
if (json != NULL)
{
@@ -3500,7 +3500,7 @@ ch_expr_common(typval_T *argvars, typval_T *rettv, int eval)
id = ++channel->ch_last_msg_id;
text = json_encode_nr_expr(id, &argvars[1],
ch_mode == MODE_JS ? JSON_JS : 0);
(ch_mode == MODE_JS ? JSON_JS : 0) | JSON_NL);
if (text == NULL)
return;