diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-04-03 08:49:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-03 08:49:39 -0400 |
commit | abdda664108646a8f1bd3112abb8083d721d38e6 (patch) | |
tree | 812803dea9448f804c6080b7a50b67b5d7a794c7 /src/nvim/eval.c | |
parent | 6db3ba9df27619703947fee11493354ca3a06878 (diff) | |
download | rneovim-abdda664108646a8f1bd3112abb8083d721d38e6.tar.gz rneovim-abdda664108646a8f1bd3112abb8083d721d38e6.tar.bz2 rneovim-abdda664108646a8f1bd3112abb8083d721d38e6.zip |
vim-patch:8.2.2694: when 'matchpairs' is empty every character beeps (#14279)
Problem: When 'matchpairs' is empty every character beeps. (Marco Hinz)
Solution: Bail out when no character in 'matchpairs' was found.
(closes vim/vim#8053) Add assert_nobeep().
https://github.com/vim/vim/commit/5b8cabfef7c3707f3e53e13844d90e5a217e1e84
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 9c3941b0fd..c9366b3bd3 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5981,6 +5981,35 @@ static void assert_append_cmd_or_arg(garray_T *gap, typval_T *argvars, } } +int assert_beeps(typval_T *argvars, bool no_beep) + FUNC_ATTR_NONNULL_ALL +{ + const char *const cmd = tv_get_string_chk(&argvars[0]); + int ret = 0; + + called_vim_beep = false; + suppress_errthrow = true; + emsg_silent = false; + do_cmdline_cmd(cmd); + if (no_beep ? called_vim_beep : !called_vim_beep) { + garray_T ga; + prepare_assert_error(&ga); + if (no_beep) { + ga_concat(&ga, (const char_u *)"command did beep: "); + } else { + ga_concat(&ga, (const char_u *)"command did not beep: "); + } + ga_concat(&ga, (const char_u *)cmd); + assert_error(&ga); + ga_clear(&ga); + ret = 1; + } + + suppress_errthrow = false; + emsg_on_display = false; + return ret; +} + int assert_fails(typval_T *argvars) FUNC_ATTR_NONNULL_ALL { |