diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2016-05-03 13:35:04 +0900 |
---|---|---|
committer | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2016-05-27 10:33:44 +0900 |
commit | 41c0dfd5454702d639d97c44a8fd38cbdd2ff0ba (patch) | |
tree | 808a8322cf61a56ba3a84bf0fc49b882cdb3c484 /src/nvim/message.c | |
parent | bfbc974d13c46ace84bec261263ab044b8c81265 (diff) | |
download | rneovim-41c0dfd5454702d639d97c44a8fd38cbdd2ff0ba.tar.gz rneovim-41c0dfd5454702d639d97c44a8fd38cbdd2ff0ba.tar.bz2 rneovim-41c0dfd5454702d639d97c44a8fd38cbdd2ff0ba.zip |
Port capture() function
https://groups.google.com/forum/#!msg/vim_dev/H3Z3ChSUh_4/beZs6KzYdBsJ
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 521db85cf0..02201107db 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -2389,6 +2389,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; |