aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/message.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-06-20 00:39:46 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-06-20 00:55:41 -0400
commit8a4e5b4bc23765bf5846f92f438b3721a3076700 (patch)
tree23c19501cdf1c40d30c9a9291a586d9b83818ff6 /src/nvim/message.c
parentd5ddebe9e23ea60be26b34a02f016194cf8d6874 (diff)
parent41c0dfd5454702d639d97c44a8fd38cbdd2ff0ba (diff)
downloadrneovim-8a4e5b4bc23765bf5846f92f438b3721a3076700.tar.gz
rneovim-8a4e5b4bc23765bf5846f92f438b3721a3076700.tar.bz2
rneovim-8a4e5b4bc23765bf5846f92f438b3721a3076700.zip
Merge #4697 'capture() function'.
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r--src/nvim/message.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index dd4eedbfb9..77e8f0e4f2 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -2392,6 +2392,19 @@ static void redir_write(char_u *str, int maxlen)
char_u *s = str;
static int cur_col = 0;
+ if (maxlen == 0) {
+ return;
+ }
+
+ // Append output to capture().
+ if (capture_ga) {
+ size_t len = 0;
+ while (str[len] && (maxlen < 0 ? 1 : (len < (size_t)maxlen))) {
+ len++;
+ }
+ ga_concat_len(capture_ga, (const char *)str, len);
+ }
+
/* Don't do anything for displaying prompts and the like. */
if (redir_off)
return;