Annoying beep on Alt+Backspace
-
“[try] disabling the sound by using windows sound applet”?? Srsly?
-
@Tony-Lezard said:
“[try] disabling the sound by using windows sound applet”?? Srsly?
Yes seriously. This is a Windows sound generated by Windows. Open up any application that has text input and press “Alt+Backspace”…guess what…it plays the sound. This is not specific to Notepad++.
-
Welcome to the land of Notepad++, where “workarounds” abound! That’s an answer to your “Srsly?” which I presumes mean “Seriously?” – and, by the way, here’s another “seriously”: If you can’t take the time to spell out words here, most people won’t take you seriously enough to give you a reply.
So here are some other options that will allow Undo functionality (and can be tied to Alt+Backspace) that don’t sound the “error bell”, at least for me:
-
a simple Pythonscript:
editor.undo()
-
a NppExec command:
I’m not an expert, so this may not be the most succinct, but it worked for me:
NPP_CONSOLE 0
SCI_SENDMSG 2176
-
-
Thanks for the warm welcome both of you. dail: so clueless I don’t know where to start. Scott: thanks for the suggestions but all these 3rd party plugins appear to be 32bit only and I was hoping to stick with 64bit NPP. The developers should really be treating this as a bug as ctrl-Z and Alt-Backspace should act identically.
-
I thought @dail 's answer was a really good one. Guess I’m also in the Clueless Club…
-
@Alan I’ll explain: dail’s answer misses the point entirely. Yes it’s a Windows sound (the Default Beep), but it’s being triggered by Notepad++. It shouldn’t be doing this because it’s incorrect behaviour from an HCI standpoint, and the key combination should act identically to ctrl-Z. Turning the sound off at the OS level is a global solution to a local problem - it interferes with other applications whose use of sound might be both correct and important. Finally, the rest of what he says is just plain wrong.
-
@Tony-Lezard I’ll explain.
What did @dail said which is completely wrong exactly?
He said: “Open up any application that has text input and press “Alt+Backspace”…guess what…it plays the sound.”
Did you try it?
Is it WRONG or RIGHT?Microsoft added some default “user interface” related sounds to Windows.
99% of intelligent users are unaware of them because disabling these sounds is the 3rd thing they do during 1st login to a fresh Windows installation.
But for those who do not disable them Microsoft cannot trust applications to use them explicitly. The triggering of these sounds is automatic within Microsofts own controls and widgets in response to specific WIN32 messages. An application CAN NOT disable a sound that is generated from within the MENU control in response to some windows message.And like most cry babies, who are too lazy to research, you are in the wrong place.
This forum is for knowledge transfer and workarounds from users to users.
If you want a fix in the code, go ask a developer here and leave this forum for polite people. -
This isn’t a notepad++ bug. It is a windows bug for beeping on alt-backpsace but not on ctrl-z. Since the two shortcuts do the same function, it is windows that should be treating the two the same and beeping or not beeping. The people you should be talking to to make it consistent is microsoft not the notepad++ developers. When microsoft fixes it, it will also fix your problem with it beeping when you press alt-backspace in other programs.
tldr: this is a one of the many microsoft bugs in windows and only microsoft can fix it.
-
@thunderbirdmoz
Why is it a Microsoft bug?
The fact that alt-backspace and ctrl-z have the same functionality in Notepad++ is no concern to Microsoft.
You can rearrange the shortcuts any way you want with different functionality and I am quite sure that alt-backspace will still beep.
I do not know which Microsoft control intercepts the alt-backspace message(s) and decides to beep. I think that all this beeping is stupid but it is not a bug. At some time someone at Microsoft thought that this notification will be important for the user and added it intentionally as a reaction to some obscure condition which alt-backspace match. I disagree with the need but I doubt it is a bug. -
The reason I say that is because the ctl-z and alt-backspace shortcut for undo isn’t a notepad++ thing. Its a standard windows shortcut like ctrl-insert/ctrl-c are for copy and shift-insert/ctrl-v are for paste which other programs use including msoffice. When ctrl-z and alt-backspace are pressed inside notepad++ the keypress is actioned by windows which is why it beeps for alt-backspace and not ctrl-z. notepad++ could intercept the keypress and override the behaviour but that doesnt fix the underlying problem in the big picture for tony-lezard which is that it beeps on alt-backspace in other programs as well. Thats why I said microsoft should be the one fixing this problem.
If this is not a bug then it is at least bad design because the two shortcuts have the same functionality so the behaviour should be consistent too. Either both ctrl-z and alt-backspace should beep or they shouldnt. And the beeping should be configurable as a separate entry in controlpanel\sounds but microsoft has shoehorned it into a general entry so if you turn off the beep who knows what else it turns off the beeping for, something else tony-lezard pointed out but again thats because microsoft has caused this.
If you want to see where else microsoft has messed up the consistency of ctrl-z and alt-backspace, have a look at it’s behaviour in the notepad program that comes with windows 10. The behaviour is all over the place even though the drop down menu says it should do undo only.
-
Undo for Notepad++ is implemented within Scintilla.
ctrl-z keypress is handled directly by Scintilla. Microsoft code has nothing to do with it.
Not sure about alt-backspace (the shortcut mapper GUI is difficult to browse). Possibly Windows intercepts it, beeps and then forwards another message that is captured by Scintilla and trigger undo. -
@gstavi said:
You can rearrange the shortcuts any way you want with different functionality and I am quite sure that alt-backspace will still beep.
Alt+Backspace does not always beep. In the two workarounds I presented above (which can be tied to Alt+Backspace) there is no beep generated.
Another quick check of desassigning Alt+Backspace from the Scintilla UNDO action and assigning it to something else I had “empty” shows that it invokes the functionality assigned without beeping.
-
@Scott-Sumner is correct and mapping alt-backspace to a different function prevents the BEEP. Probably NPP capture it and fully handle it before it reaches the BEEPING control.
I got curious enough to actually open the code. This exist in NPP shortcut table:
{TEXT("SCI_UNDO"), SCI_UNDO, true, false, false, VK_Z, IDM_EDIT_UNDO},
{TEXT(""), SCI_UNDO, false, true, false, VK_BACK, 0},
Initially I thought that maybe NPP is at fault after all because ctrl-z has IDM_EDIT_UNDO which is missing from alt-backspace.
But after commenting out the alt-backspace line and compiling I had a version of NPP where alt-backspace no longer UNDO but still BEEPS.
Since ALT-xxx shortcuts are often associated with menus I guess that this is the beeping component.