diff src/channel.c @ 9969:176e34b0d678 v7.4.2258

commit https://github.com/vim/vim/commit/f1f0792e55e72cdc7c833b30f565a9b02f18bb1e Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 26 17:58:53 2016 +0200 patch 7.4.2258 Problem: Two JSON messages are sent without a separator. Solution: Separate messages with a NL. (closes https://github.com/vim/vim/issues/1001)
author Christian Brabandt <cb@256bit.org>
date Fri, 26 Aug 2016 18:00:08 +0200
parents 9560a2eb7968
children 3b4b2ac811f0
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -2165,7 +2165,7 @@ channel_exe_cmd(channel_T *channel, int 
 		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 
 		    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
 
     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;