patch 7.4.2258
Problem: Two JSON messages are sent without a separator.
Solution: Separate messages with a NL. (closes #1001)
diff --git a/src/channel.c b/src/channel.c
index 4435248..7488574 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2165,7 +2165,7 @@
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 @@
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 @@
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;