Mercurial > vim
diff runtime/doc/channel.txt @ 9969:176e34b0d678 v7.4.2258
commit https://github.com/vim/vim/commit/f1f0792e55e72cdc7c833b30f565a9b02f18bb1e
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 26 17:58:53 2016 +0200
patch 7.4.2258
Problem: Two JSON messages are sent without a separator.
Solution: Separate messages with a NL. (closes https://github.com/vim/vim/issues/1001)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 26 Aug 2016 18:00:08 +0200 |
parents | 9eaf8ef656e9 |
children | 8061455d9179 |
line wrap: on
line diff
--- a/runtime/doc/channel.txt +++ b/runtime/doc/channel.txt @@ -1,4 +1,4 @@ -*channel.txt* For Vim version 7.4. Last change: 2016 Jul 15 +*channel.txt* For Vim version 7.4. Last change: 2016 Aug 26 VIM REFERENCE MANUAL by Bram Moolenaar @@ -247,9 +247,15 @@ In which {number} is different every tim This way Vim knows which sent message matches with which received message and can call the right handler. Also when the messages arrive out of order. +A newline character is terminating the JSON text. This can be used to +separate the read text. For example, in Python: + splitidx = read_text.find('\n') + message = read_text[:splitidx] + rest = read_text[splitidx + 1:] + The sender must always send valid JSON to Vim. Vim can check for the end of the message by parsing the JSON. It will only accept the message if the end -was received. +was received. A newline after the message is optional. When the process wants to send a message to Vim without first receiving a message, it must use the number zero: