aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/misc1.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 0008409731..4fc2451788 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -2583,10 +2583,17 @@ void vim_beep(unsigned val)
if (emsg_silent == 0) {
if (!((bo_flags & val) || (bo_flags & BO_ALL))) {
- if (p_vb) {
- ui_call_visual_bell();
- } else {
- ui_call_bell();
+ static uint64_t start_time = 0;
+
+ // Only beep once per half a second, otherwise a sequence of beeps
+ // would freeze Vim.
+ if (start_time == 0 || os_hrtime() - start_time > 500000000u) {
+ start_time = os_hrtime();
+ if (p_vb) {
+ ui_call_visual_bell();
+ } else {
+ ui_call_bell();
+ }
}
}