Merge #9897 from janlazo/vim-8.0.0683

This commit is contained in:
Justin M. Keyes 2019-05-26 18:44:35 +02:00 committed by GitHub
commit fc7861f0fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2583,10 +2583,22 @@ 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 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();
}
}
}