mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 23:18:33 +00:00
vim-patch:8.0.0683: visual bell flashes too quickly
Problem: When using a visual bell there is no delay, causing the flash to
be very short, possibly unnoticeable. Also, the flash and the
beep can lockup the UI when repeated often.
Solution: Do the delay in Vim or flush the output before the delay. Limit the
bell to once per half a second. (Ozaki Kiichi, closes vim/vim#1789)
2e147caa14
This commit is contained in:
@@ -2583,10 +2583,17 @@ 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))) {
|
||||||
if (p_vb) {
|
static uint64_t start_time = 0;
|
||||||
ui_call_visual_bell();
|
|
||||||
} else {
|
// Only beep once per half a second, otherwise a sequence of beeps
|
||||||
ui_call_bell();
|
// 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user