diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-12-10 17:11:45 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-12-10 17:11:45 +0100 |
commit | c88555418a991407a46b74dc038a0b08ad0f0162 (patch) | |
tree | 645af91db15de07484494a7d789523a269b328c2 /src/nvim/misc1.c | |
parent | 6dbd4f3787f7d6ddc27102a8d419f044c936560c (diff) | |
download | rneovim-c88555418a991407a46b74dc038a0b08ad0f0162.tar.gz rneovim-c88555418a991407a46b74dc038a0b08ad0f0162.tar.bz2 rneovim-c88555418a991407a46b74dc038a0b08ad0f0162.zip |
refactor(misc1): move way beep functions elsewhere
Diffstat (limited to 'src/nvim/misc1.c')
-rw-r--r-- | src/nvim/misc1.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 334c98b6fe..7a53775cbc 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -325,54 +325,6 @@ int prompt_for_number(int *mouse_used) return i; } -/* - * flush map and typeahead buffers and give a warning for an error - */ -void beep_flush(void) -{ - if (emsg_silent == 0) { - flush_buffers(FLUSH_MINIMAL); - vim_beep(BO_ERROR); - } -} - -// Give a warning for an error -// val is one of the BO_ values, e.g., BO_OPER -void vim_beep(unsigned val) -{ - called_vim_beep = true; - - if (emsg_silent == 0) { - if (!((bo_flags & val) || (bo_flags & BO_ALL))) { - static int beeps = 0; - static uint64_t start_time = 0; - - // Only beep up to three times per half a second, - // otherwise a sequence of beeps would freeze Vim. - if (start_time == 0 || os_hrtime() - start_time > 500000000u) { - beeps = 0; - start_time = os_hrtime(); - } - beeps++; - if (beeps <= 3) { - if (p_vb) { - ui_call_visual_bell(); - } else { - ui_call_bell(); - } - } - } - - // When 'debug' contains "beep" produce a message. If we are sourcing - // a script or executing a function give the user a hint where the beep - // comes from. - if (vim_strchr(p_debug, 'e') != NULL) { - msg_source(HL_ATTR(HLF_W)); - msg_attr(_("Beep!"), HL_ATTR(HLF_W)); - } - } -} - /// os_call_shell() wrapper. Handles 'verbose', :profile, and v:shell_error. /// Invalidates cached tags. /// |