comparison src/message.c @ 25226:a9ea83a3659a v8.2.3149

patch 8.2.3149: some plugins have a problem with the error check Commit: https://github.com/vim/vim/commit/cc7eb2aa7a7f2e6ae41f1e7cf60965c083d8a9e9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 11 19:12:04 2021 +0200 patch 8.2.3149: some plugins have a problem with the error check 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 11 Jul 2021 19:15:03 +0200
parents ac0211a9fb6a
children 0082503ff2ff
comparison
equal deleted inserted replaced
25225:2bdf399b2884 25226:a9ea83a3659a
3612 * Use 'w' highlighting and may repeat the message after redrawing 3612 * Use 'w' highlighting and may repeat the message after redrawing
3613 */ 3613 */
3614 void 3614 void
3615 give_warning(char_u *message, int hl) 3615 give_warning(char_u *message, int hl)
3616 { 3616 {
3617 give_warning_with_source(message, hl, FALSE);
3618 }
3619
3620 void
3621 give_warning_with_source(char_u *message, int hl, int with_source)
3622 {
3617 // Don't do this for ":silent". 3623 // Don't do this for ":silent".
3618 if (msg_silent != 0) 3624 if (msg_silent != 0)
3619 return; 3625 return;
3620 3626
3621 // Don't want a hit-enter prompt here. 3627 // Don't want a hit-enter prompt here.
3627 VIM_CLEAR(keep_msg); 3633 VIM_CLEAR(keep_msg);
3628 if (hl) 3634 if (hl)
3629 keep_msg_attr = HL_ATTR(HLF_W); 3635 keep_msg_attr = HL_ATTR(HLF_W);
3630 else 3636 else
3631 keep_msg_attr = 0; 3637 keep_msg_attr = 0;
3632 if (msg_attr((char *)message, keep_msg_attr) && msg_scrolled == 0) 3638
3639 if (with_source)
3640 {
3641 // Do what msg() does, but with a column offset if the warning should
3642 // be after the mode message.
3643 msg_start();
3644 msg_source(HL_ATTR(HLF_W));
3645 msg_puts(" ");
3646 msg_puts_attr((char *)message, HL_ATTR(HLF_W) | MSG_HIST);
3647 msg_clr_eos();
3648 (void)msg_end();
3649 }
3650 else if (msg_attr((char *)message, keep_msg_attr) && msg_scrolled == 0)
3633 set_keep_msg(message, keep_msg_attr); 3651 set_keep_msg(message, keep_msg_attr);
3652
3634 msg_didout = FALSE; // overwrite this message 3653 msg_didout = FALSE; // overwrite this message
3635 msg_nowait = TRUE; // don't wait for this message 3654 msg_nowait = TRUE; // don't wait for this message
3636 msg_col = 0; 3655 msg_col = 0;
3637 3656
3638 --no_wait_return; 3657 --no_wait_return;