comparison 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
comparison
equal deleted inserted replaced
9245:fe03dc56fba7 9246:6ee88fa405b3
380 * While there's still a command in the work queue, parse and execute it. 380 * While there's still a command in the work queue, parse and execute it.
381 */ 381 */
382 void 382 void
383 netbeans_parse_messages(void) 383 netbeans_parse_messages(void)
384 { 384 {
385 readq_T *node;
385 char_u *buffer; 386 char_u *buffer;
386 char_u *p; 387 char_u *p;
387 int own_node; 388 int own_node;
388 389
389 while (nb_channel != NULL) 390 while (nb_channel != NULL)
390 { 391 {
391 buffer = channel_peek(nb_channel, PART_SOCK); 392 node = channel_peek(nb_channel, PART_SOCK);
392 if (buffer == NULL) 393 if (node == NULL)
393 break; /* nothing to read */ 394 break; /* nothing to read */
394 395
395 /* Locate the first line in the first buffer. */ 396 /* Locate the first line in the first buffer. */
396 p = vim_strchr(buffer, '\n'); 397 p = channel_first_nl(node);
397 if (p == NULL) 398 if (p == NULL)
398 { 399 {
399 /* Command isn't complete. If there is no following buffer, 400 /* Command isn't complete. If there is no following buffer,
400 * return (wait for more). If there is another buffer following, 401 * return (wait for more). If there is another buffer following,
401 * prepend the text to that buffer and delete this one. */ 402 * prepend the text to that buffer and delete this one. */
416 } 417 }
417 else 418 else
418 own_node = FALSE; 419 own_node = FALSE;
419 420
420 /* now, parse and execute the commands */ 421 /* now, parse and execute the commands */
421 nb_parse_cmd(buffer); 422 nb_parse_cmd(node->rq_buffer);
422 423
423 if (own_node) 424 if (own_node)
424 /* buffer finished, dispose of it */ 425 /* buffer finished, dispose of it */
425 vim_free(buffer); 426 vim_free(node->rq_buffer);
426 else 427 else
427 /* more follows, move it to the start */ 428 /* more follows, move it to the start */
428 STRMOVE(buffer, p); 429 channel_consume(nb_channel, PART_SOCK, (int)(p - buffer));
429 } 430 }
430 } 431 }
431 } 432 }
432 433
433 /* 434 /*