summaryrefslogtreecommitdiffstats
path: root/src/message.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-11 19:12:04 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-11 19:12:04 +0200
commitcc7eb2aa7a7f2e6ae41f1e7cf60965c083d8a9e9 (patch)
tree5d54a35c88c61f041e7cdd16ba3ad9aa40a084ef /src/message.c
parent5231224e11bf468f5366a7400414368908c40795 (diff)
patch 8.2.3149: some plugins have a problem with the error checkv8.2.3149
Problem: Some plugins have a problem with the error check for using :command with -complete but without -nargs. Solution: In legacy script only give a warning message.
Diffstat (limited to 'src/message.c')
-rw-r--r--src/message.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/message.c b/src/message.c
index cb713d7210..7fb7264bd8 100644
--- a/src/message.c
+++ b/src/message.c
@@ -3614,6 +3614,12 @@ verbose_open(void)
void
give_warning(char_u *message, int hl)
{
+ give_warning_with_source(message, hl, FALSE);
+}
+
+ void
+give_warning_with_source(char_u *message, int hl, int with_source)
+{
// Don't do this for ":silent".
if (msg_silent != 0)
return;
@@ -3629,8 +3635,21 @@ give_warning(char_u *message, int hl)
keep_msg_attr = HL_ATTR(HLF_W);
else
keep_msg_attr = 0;
- if (msg_attr((char *)message, keep_msg_attr) && msg_scrolled == 0)
+
+ if (with_source)
+ {
+ // Do what msg() does, but with a column offset if the warning should
+ // be after the mode message.
+ msg_start();
+ msg_source(HL_ATTR(HLF_W));
+ msg_puts(" ");
+ msg_puts_attr((char *)message, HL_ATTR(HLF_W) | MSG_HIST);
+ msg_clr_eos();
+ (void)msg_end();
+ }
+ else if (msg_attr((char *)message, keep_msg_attr) && msg_scrolled == 0)
set_keep_msg(message, keep_msg_attr);
+
msg_didout = FALSE; // overwrite this message
msg_nowait = TRUE; // don't wait for this message
msg_col = 0;