Skip to content

Set-PSReadLineOption BellStyle should have an option for an actual ASCII 7 bell #4766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
jantari opened this issue May 30, 2025 · 1 comment
Open
1 task done
Labels
Issue-Enhancement It's a feature request. Needs-Triage 🔍 It's a new issue that core contributor team needs to triage.

Comments

@jantari
Copy link

jantari commented May 30, 2025

Prerequisites

  • Write a descriptive title.

Description of the new feature/enhancement

Hello,

I just realized this today but, even in the latest PSReadLine 2.3.6 when I configure the "Bell notification style" in Windows Terminal to, for example, ["window", "taskbar"] (briefly flash the console screen + taskbar icon) instead of audible (make the irritating pcspeaker noise) PSReadLine does not honor this setting - it still makes a sharp blip-like sound. I'm guessing PSReadLine does not emit an actual ASCII 0x7 BELL but rather implements its own sound playback.

This is very bad because:

  1. For the user it is unexpected behavior for a program emitting a BELL to not adhere to the terminals configured treatment of BELL signals
  2. PSReadLines only BELL configuration options are "Audible" (default), "Visual" and "None" but the hosting terminal application can have more abilities to indicate a BELL
  3. PSReadLine in practice really only has "Audible" and "None" as BellStyles because, at least on my machine, "Visual" does absolutely nothing making it equivalent to "None"
  4. Whatever custom BELL implementation PSReadLine has, it's got to be more lines of code than putchar(7); arguably making it a code smell and unnecessary bloat?

Proposed technical implementation details (optional)

I propose to add a BellStyle option that just makes PSReadLine, well, emit an actual 0x07 BELL. Also, I would very much like for this BellStyle (call it -BellStyle ASCIIBell or whatever) to be the new default BellStyle. Users who unironically prefer the eardrum-shattering, high-pitched blip of the current implementation can always change it back to Audible.

EDIT: Link to Windows Terminal BELL style configuration docs: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/profile-advanced#bell-notification-style

@jantari jantari added the Issue-Enhancement It's a feature request. label May 30, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label May 30, 2025
@jantari
Copy link
Author

jantari commented May 30, 2025

It is not an issue for me, but since I brought it up I'll also add my repro for "-BellStyle Visual" not doing anything:

  1. Run PowerShell 7.5.1 or Windows Powershell 5.1 with PSReadLine 2.3.6 installed and loaded
  2. Test the Bell signal by ensuring it is set to "Audible": Set-PSReadLineOption -BellStyle Audible
  3. Press Ctrl + R in PowerShell to open the backwards history search, don't type in anything but start pressing Backspace
  4. You will hear what PSReadLine calls a "Bell"
  5. Change the BellStyle to "Visual": Set-PSReadLineOption -BellStyle Visual
  6. Press Ctrl + R in PowerShell to open the backwards history search, don't type in anything but start pressing Backspace
  7. Nothing happens at all

If PSReadLine just respected my Windows Terminal BELL configuration then it would work nicely and as intended out of the box.

EDIT: well I guess that would explain -BellStyle Visual not doing anything

case BellStyle.Visual:
// TODO: flash prompt? command line?
break;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement It's a feature request. Needs-Triage 🔍 It's a new issue that core contributor team needs to triage.
Projects
None yet
Development

No branches or pull requests

1 participant