re-enable terminal's beep and use... something else! #23201
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the REPL, when an action cannot be done, the user can be
notified by animating the prompt - no need to use built-in
terminal's beep ('\a'), which is anyway often disabled.
Alternative to #9710, which discuss the merits of having a visual feed-back sometimes (e.g. when <TAB> shows no completion, is it that the current word is valid, or that there are no completion for it?)
The idea here is to make the prompt blink. I like it sober, so it blinks once by default, alternating with
:light_black
color (can be customized). This is done asynchronously, so that it's not blocking. If a beep is requested when already "beeping", theduration
(by default 0.2s) adds up, to a maximum ofmaxduration
.blink
sets the duration of a blink, but maybe should be changed to mean the number of blinks.Here is a small screenshot: first the word "qwe<TAB>" is typed and then it blinks because there are no completion. Then <BACKSPACE> is held so that blinking accumulates to the maximum value, then the repl is used (and complection used on "function") while blinking:![beep3](https://user-images.githubusercontent.com/8462914/29184278-eea639b0-7e05-11e7-9e4e-14c4cbd01997.gif)
I'm not quite sure my locking scheme is OK. Will have to check again (and I could use some advices...).
EDIT: it you want to try, it's easy to customize, e.g.
(Am still in awe of 265 solved...)