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.
This commit is contained in:
ZyX
2017-06-28 22:09:10 +03:00
parent 9ccb3abbb5
commit 3da49cd68e
3 changed files with 61 additions and 23 deletions

View File

@@ -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.