diff options
author | ZyX <kp-pav@yandex.ru> | 2017-06-28 22:09:10 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-06-28 22:09:10 +0300 |
commit | 3da49cd68e7d5c968cc99a926819038ff57f488f (patch) | |
tree | 1c41cb3f55e184278cbfc465abee90242bc7f3fc /src/nvim/message.c | |
parent | 9ccb3abbb55ec8ed7f3b4d2d2516fd451eca9a68 (diff) | |
download | rneovim-3da49cd68e7d5c968cc99a926819038ff57f488f.tar.gz rneovim-3da49cd68e7d5c968cc99a926819038ff57f488f.tar.bz2 rneovim-3da49cd68e7d5c968cc99a926819038ff57f488f.zip |
ex_getln: Fix “echoerr msg not shown” problem
This also attempted to fix problem with cancelling input() on error by avoiding
standard error printing facilities (assumed thrown error message is the
problem), but with no luck so far.
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 057ce75f79..ab918712e5 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1611,6 +1611,27 @@ void msg_puts_attr_len(const char *const str, const ptrdiff_t len, int attr) } } +/// Print a formatted message +/// +/// Message printed is limited by #IOSIZE. Must not be used from inside +/// msg_puts_attr(). +/// +/// @param[in] attr Highlight attributes. +/// @param[in] fmt Format string. +void msg_printf_attr(const int attr, const char *const fmt, ...) + FUNC_ATTR_NONNULL_ALL +{ + static char msgbuf[IOSIZE]; + + va_list ap; + va_start(ap, fmt); + const size_t len = vim_vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap, NULL); + va_end(ap); + + msg_scroll = true; + msg_puts_attr_len(msgbuf, (ptrdiff_t)len, attr); +} + /* * The display part of msg_puts_attr_len(). * May be called recursively to display scroll-back text. |