summaryrefslogtreecommitdiffstats
path: root/src/channel.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-06-28 22:06:49 +0200
committerBram Moolenaar <Bram@vim.org>2019-06-28 22:06:49 +0200
commit4340fc95d50518c6eb199107e5f1144f210c7ee5 (patch)
tree326e8a11f2ce433ab4998ae341d68bb8d13d438d /src/channel.c
parent13b47c37a650ab6045680a9e5513ef6ad71ee93f (diff)
patch 8.1.1605: Vim may delay processing messages on a json channelv8.1.1605
Problem: Vim may delay processing messages on a json channel. (Pontus Leitzler) Solution: Try parsing json when checking if there is readahead.
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/channel.c b/src/channel.c
index 7671e19a62..eb5af0aa46 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2851,9 +2851,13 @@ channel_has_readahead(channel_T *channel, ch_part_T part)
if (ch_mode == MODE_JSON || ch_mode == MODE_JS)
{
jsonq_T *head = &channel->ch_part[part].ch_json_head;
- jsonq_T *item = head->jq_next;
- return item != NULL;
+ if (head->jq_next == NULL)
+ // Parse json from readahead, there might be a complete message to
+ // process.
+ channel_parse_json(channel, part);
+
+ return head->jq_next != NULL;
}
return channel_peek(channel, part) != NULL;
}