aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/message.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-11-26 13:08:42 +0100
committerGitHub <noreply@github.com>2016-11-26 13:08:42 +0100
commit7be113d7959df83bdec1e4d9a3e98264bc5d7a5b (patch)
tree317848900cdb67588f8cfbeb38d6fbd22a621051 /src/nvim/message.c
parentecd7beb6e4876961075cc211d2b92f987d670dfa (diff)
downloadrneovim-7be113d7959df83bdec1e4d9a3e98264bc5d7a5b.tar.gz
rneovim-7be113d7959df83bdec1e4d9a3e98264bc5d7a5b.tar.bz2
rneovim-7be113d7959df83bdec1e4d9a3e98264bc5d7a5b.zip
shell_write_cb: Schedule error message. (#5670)
Closes #5558
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r--src/nvim/message.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 1de2347b12..f9cfc49197 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -19,6 +19,7 @@
#include "nvim/fileio.h"
#include "nvim/func_attr.h"
#include "nvim/getchar.h"
+#include "nvim/main.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"
#include "nvim/misc1.h"
@@ -581,6 +582,24 @@ bool emsgf(const char *const fmt, ...)
return emsg(IObuff);
}
+static void msg_emsgf_event(void **argv)
+{
+ char *s = argv[0];
+ (void)emsg((char_u *)s);
+ xfree(s);
+}
+
+void msg_schedule_emsgf(const char *const fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vim_vsnprintf((char *)IObuff, IOSIZE, fmt, ap, NULL);
+ va_end(ap);
+
+ char *s = xstrdup((char *)IObuff);
+ loop_schedule(&main_loop, event_create(1, msg_emsgf_event, 1, s));
+}
+
/*
* Like msg(), but truncate to a single line if p_shm contains 't', or when
* "force" is TRUE. This truncates in another way as for normal messages.