0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

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.
This commit is contained in:
Bram Moolenaar
2016-06-07 22:16:36 +02:00
parent fdd82fe365
commit 5f1032d2a5
4 changed files with 113 additions and 42 deletions

View File

@@ -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));
}
}
}