aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-25 11:15:24 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-25 11:15:24 -0400
commit5e048baa5fd5c0d38448d9b0e3511c247ad47ec7 (patch)
tree376329d02c3f73a525e007fd75be50a2ecae33d7
parent138110e082e95ff82f042591c476b7479ba436e0 (diff)
downloadrneovim-5e048baa5fd5c0d38448d9b0e3511c247ad47ec7.tar.gz
rneovim-5e048baa5fd5c0d38448d9b0e3511c247ad47ec7.tar.bz2
rneovim-5e048baa5fd5c0d38448d9b0e3511c247ad47ec7.zip
Allow 3 beeps per half a second
-rw-r--r--src/nvim/misc1.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 4fc2451788..4cc6c150e0 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -2583,12 +2583,17 @@ void vim_beep(unsigned val)
if (emsg_silent == 0) {
if (!((bo_flags & val) || (bo_flags & BO_ALL))) {
+ static int beeps = 0;
static uint64_t start_time = 0;
- // Only beep once per half a second, otherwise a sequence of beeps
- // would freeze Vim.
+ // 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 {