Visual bells do not work #85

Closed
opened 2026-01-30 21:41:55 +00:00 by claunia · 8 comments
Owner

Originally created by @bitcrazed on GitHub (Feb 16, 2018).

From @yoctozepto on November 16, 2017 11:6

As mentioned in #715 - visual bells do not work - the terminal does not blink.

How to reproduce?

Enable visual bells either in bash:
set bell-style visible
in
~/.inputrc
or vim:
set visualbell
in
~/.vimrc
and execute any action triggering a bell (e.g. walking past the buffer).

The terminal should blink but it does not.

Extra info

Sound bells do work (the beeping) when enabled (by default).

This functionality is useful for people disabling sounds and still hoping to get some feedback that they are doing something wrong. :-)

Copied from original issue: Microsoft/WSL#2678

Originally created by @bitcrazed on GitHub (Feb 16, 2018). _From @yoctozepto on November 16, 2017 11:6_ As mentioned in #715 - visual bells do not work - the terminal does not blink. ### How to reproduce? Enable visual bells either in bash: `set bell-style visible` in `~/.inputrc` or vim: `set visualbell` in `~/.vimrc` and execute any action triggering a bell (e.g. walking past the buffer). The terminal should blink but it does not. ### Extra info Sound bells do work (the beeping) when enabled (by default). This functionality is useful for people disabling sounds and still hoping to get some feedback that they are doing something wrong. :-) _Copied from original issue: Microsoft/WSL#2678_
Author
Owner

@ghost commented on GitHub (Feb 21, 2019):

Has there been any movement on this in the past year?

@ghost commented on GitHub (Feb 21, 2019): Has there been any movement on this in the past year?
Author
Owner

@zadjii-msft commented on GitHub (Feb 21, 2019):

Nope.

@zadjii-msft commented on GitHub (Feb 21, 2019): Nope.
Author
Owner

@andreas-wilm commented on GitHub (Apr 22, 2019):

+1

@andreas-wilm commented on GitHub (Apr 22, 2019): +1
Author
Owner

@zadjii-msft commented on GitHub (Apr 22, 2019):

@andreas-wilm Please don't comment "+1" on issues without providing valuable, additional information. It creates unnecessary email noise for everyone following the issue. There's a perfectly good +1 button you can use to express the same sentiment without pinging everyone on the thread.
image

@zadjii-msft commented on GitHub (Apr 22, 2019): @andreas-wilm Please don't comment "+1" on issues without providing valuable, additional information. It creates unnecessary email noise for everyone following the issue. There's a perfectly good +1 button you can use to express the same sentiment without pinging everyone on the thread. ![image](https://user-images.githubusercontent.com/18356694/56509812-8d2bde80-64ed-11e9-9044-b26694bb08ee.png)
Author
Owner

@andreas-wilm commented on GitHub (Apr 23, 2019):

Apologies. You're absolutely right of course. Last time I make noise here

@andreas-wilm commented on GitHub (Apr 23, 2019): Apologies. You're absolutely right of course. Last time I make noise here
Author
Owner

@egmontkob commented on GitHub (Jun 24, 2019):

My terminfo entry (on Ubuntu, for xterm-256color) contains this entry:

flash=\E[?5h$<100/>\E[?5l

where I guess that $<100/> stands for an intended pause of this many milliseconds.

strace'ing bash reveals that on visual bell it does a

write(2, "\33[?5h\33[?5l", 10)          = 10

that is, switches to global reverse mode and then immediately back to normal. I don't know if MS Terminal supports global reverse mode, but even if it does, if an app immediately reverts it then it makes perfect sense that the display is actually never reversed. So I'd argue there's a bug in bash to begin with, by omitting the delay. (I haven't checked vim.)

(And on a side note, I'd argue that this escape sequence is broken by design. A visual bell cannot reliably be shown over an ssh or such, since due to timing differences the length of the flash varies a lot, including easily not being shown at all. Instead, IMO, it would be a better approach if applications kept emitting \a for bell, and it was the terminal emulator that could decide to handle it differently than playing a sound, e.g. by reversing the contents for 0.1 seconds, or showing an animated ring icon etc.)

@egmontkob commented on GitHub (Jun 24, 2019): My terminfo entry (on Ubuntu, for xterm-256color) contains this entry: flash=\E[?5h$<100/>\E[?5l where I _guess_ that `$<100/>` stands for an intended pause of this many milliseconds. strace'ing bash reveals that on visual bell it does a write(2, "\33[?5h\33[?5l", 10) = 10 that is, switches to global reverse mode and then immediately back to normal. I don't know if MS Terminal supports global reverse mode, but even if it does, if an app immediately reverts it then it makes perfect sense that the display is actually never reversed. So I'd argue there's a bug in bash to begin with, by omitting the delay. (I haven't checked vim.) (And on a side note, I'd argue that this escape sequence is broken by design. A visual bell cannot reliably be shown over an ssh or such, since due to timing differences the length of the flash varies a lot, including easily not being shown at all. Instead, IMO, it would be a better approach if applications kept emitting `\a` for bell, and it was the terminal emulator that could decide to handle it differently than playing a sound, e.g. by reversing the contents for 0.1 seconds, or showing an animated ring icon etc.)
Author
Owner

@j4james commented on GitHub (Dec 3, 2019):

For the record, I've just submitted PR #3817, which mostly fixes this issue. Executing tput flash now flashes the screen, and the visualbell in vim now works, but the bash visible bell-style does not. As @egmontkob explained above, the way the bash visible bell is implemented, there is not enough of a delay for the flash to be discernible.

Personally I'm in agreement with @egmontkob that that is a bug in bash, and not something we should be trying to fix. But I'll leave that call for the MS devs to make.

@j4james commented on GitHub (Dec 3, 2019): For the record, I've just submitted PR #3817, which mostly fixes this issue. Executing `tput flash` now flashes the screen, and the visualbell in vim now works, but the bash visible bell-style does not. As @egmontkob explained above, the way the bash visible bell is implemented, there is not enough of a delay for the flash to be discernible. Personally I'm in agreement with @egmontkob that that is a bug in bash, and not something we should be trying to fix. But I'll leave that call for the MS devs to make.
Author
Owner

@zadjii-msft commented on GitHub (Oct 4, 2021):

You know, the fundamental support for this was added in #3817, even to conhost, so I'm gonna close this one out as fixed.

@zadjii-msft commented on GitHub (Oct 4, 2021): You know, the fundamental support for this was added in #3817, even to conhost, so I'm gonna close this one out as fixed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#85