changeset 8204:08d251a1c178 v7.4.1395

commit https://github.com/vim/vim/commit/eed284a16977ab81fa6da8c9562990ba498acd8c Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 22 23:13:33 2016 +0100 patch 7.4.1395 Problem: Using DETACH in quotes is not compatible with the Netbeans interface. (Xavier de Gaye) Solution: Remove the quotes, only use them for JSON and JS mode.
author Christian Brabandt <cb@256bit.org>
date Mon, 22 Feb 2016 23:15:04 +0100
parents 54a1717883ef
children 22d94e059fc7
files src/channel.c src/netbeans.c src/version.c
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -1554,7 +1554,8 @@ channel_free_all(void)
 
 
 /* Sent when the channel is found closed when reading. */
-#define DETACH_MSG "\"DETACH\"\n"
+#define DETACH_MSG_RAW "DETACH\n"
+#define DETACH_MSG_JSON "\"DETACH\"\n"
 
 /* Buffer size for reading incoming messages. */
 #define MAXMSGSIZE 4096
@@ -1658,6 +1659,7 @@ channel_read(channel_T *channel, int par
     int			readlen = 0;
     sock_T		fd;
     int			use_socket = FALSE;
+    char		*msg;
 
     fd = channel->ch_part[part].ch_fd;
     if (fd == INVALID_FD)
@@ -1721,8 +1723,10 @@ channel_read(channel_T *channel, int par
 	 *			-> channel_read()
 	 */
 	ch_errors(channel, "%s(): Cannot read", func);
-	channel_save(channel, part,
-			       (char_u *)DETACH_MSG, (int)STRLEN(DETACH_MSG));
+	msg = channel->ch_part[part].ch_mode == MODE_RAW
+				  || channel->ch_part[part].ch_mode == MODE_NL
+		    ? DETACH_MSG_RAW : DETACH_MSG_JSON;
+	channel_save(channel, part, (char_u *)msg, (int)STRLEN(msg));
 
 	/* TODO: When reading from stdout is not possible, should we try to
 	 * keep stdin and stderr open?  Probably not, assume the other side
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -461,7 +461,7 @@ nb_parse_cmd(char_u *cmd)
 	/* NOTREACHED */
     }
 
-    if (STRCMP(cmd, "\"DETACH\"") == 0)
+    if (STRCMP(cmd, "DETACH") == 0)
     {
 	buf_T	*buf;
 
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1395,
+/**/
     1394,
 /**/
     1393,