diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-08-16 00:20:37 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-08-16 00:20:37 +0200 |
commit | bb70eec17782501db35683f48136fcced9eae259 (patch) | |
tree | 2c0185c522e0c32f6a553098dc706a9ac26cb8be /src/nvim/message.c | |
parent | ab72063a52248cc5c173424d82cfee001a40e93c (diff) | |
parent | 19a28352a925b0a8502d57ec4f42b1412639aa6c (diff) | |
download | rneovim-bb70eec17782501db35683f48136fcced9eae259.tar.gz rneovim-bb70eec17782501db35683f48136fcced9eae259.tar.bz2 rneovim-bb70eec17782501db35683f48136fcced9eae259.zip |
Merge #6364 'command-line color hook'
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 28c88f5a14..b90c475ede 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1628,6 +1628,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_ARG(2) +{ + 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. |