diff src/netbeans.c @ 9246:6ee88fa405b3 v7.4.1906

commit https://github.com/vim/vim/commit/5f1032d2a55b9417a0a6fa225e35089c98a5a419 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 7 22:16:36 2016 +0200 patch 7.4.1906 Problem: Collapsing channel buffers and searching for NL does not work properly. (Xavier de Gary, Ramel Eshed) Solution: Do not assume the buffer contains a NUL or not. Change NUL bytes to NL to avoid the string is truncated.
author Christian Brabandt <cb@256bit.org>
date Tue, 07 Jun 2016 22:30:06 +0200
parents d2d44592467d
children d82724272c61
line wrap: on
line diff
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -382,18 +382,19 @@ handle_key_queue(void)
     void
 netbeans_parse_messages(void)
 {
+    readq_T	*node;
     char_u	*buffer;
     char_u	*p;
     int		own_node;
 
     while (nb_channel != NULL)
     {
-	buffer = channel_peek(nb_channel, PART_SOCK);
-	if (buffer == NULL)
+	node = channel_peek(nb_channel, PART_SOCK);
+	if (node == NULL)
 	    break;	/* nothing to read */
 
 	/* Locate the first line in the first buffer. */
-	p = vim_strchr(buffer, '\n');
+	p = channel_first_nl(node);
 	if (p == NULL)
 	{
 	    /* Command isn't complete.  If there is no following buffer,
@@ -418,14 +419,14 @@ netbeans_parse_messages(void)
 		own_node = FALSE;
 
 	    /* now, parse and execute the commands */
-	    nb_parse_cmd(buffer);
+	    nb_parse_cmd(node->rq_buffer);
 
 	    if (own_node)
 		/* buffer finished, dispose of it */
-		vim_free(buffer);
+		vim_free(node->rq_buffer);
 	    else
 		/* more follows, move it to the start */
-		STRMOVE(buffer, p);
+		channel_consume(nb_channel, PART_SOCK, (int)(p - buffer));
 	}
     }
 }