mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
Merge #9897 from janlazo/vim-8.0.0683
This commit is contained in:
@@ -2583,12 +2583,24 @@ void vim_beep(unsigned val)
|
|||||||
|
|
||||||
if (emsg_silent == 0) {
|
if (emsg_silent == 0) {
|
||||||
if (!((bo_flags & val) || (bo_flags & BO_ALL))) {
|
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) {
|
if (p_vb) {
|
||||||
ui_call_visual_bell();
|
ui_call_visual_bell();
|
||||||
} else {
|
} else {
|
||||||
ui_call_bell();
|
ui_call_bell();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// When 'debug' contains "beep" produce a message. If we are sourcing
|
// 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
|
// a script or executing a function give the user a hint where the beep
|
||||||
|
Reference in New Issue
Block a user