Disable ASCII Control characters shortcuts?
-
@Alan-Kilborn said in Disable ASCII Control characters shortcuts?:
but if you mean can Notepad++ alone achieve it, the answer is No, it can’t.
In light of @mkupper 's post, I’ll qualify mine:
I sensed the recent poster was looking for a simple checkbox of the form:
- Disallow control character entry via typing
And, as that preference setting doesn’t exist, I said it couldn’t be done with Notepad++.
Obviously, one can come up with a list of unassigned Ctrl+??? combinations and create do-nothing macros for all of them (I suppose there aren’t too many).
However, I’d suggest assigning a SCI_NULL operation to them; SCI_NULL is Scintilla command id 2172.
-
Thanks @mkupper! It looks like the way to implement that would be to edit the
shortcuts.xml
file and paste in those lines you shared.
npp-user-manual dot org/docs/macros/
I guess for the Scintilla method we edit the same file with a similar format, replacing the existing
<ScintillaKeys />
line.For now, I’ve just assigned basic hotkeys to the main ones I was having trouble with.
-
@MaximilianKohler said in Disable ASCII Control characters shortcuts?:
It looks like the way to implement that would be to edit the shortcuts.xml file and paste in those lines you shared.
npp-user-manual dot org/docs/macros/That is correct. I have not looked at github yet to see if there is not already a feature request too add a setting
Ignore unrecognized keyboard Ctrl codes
. I don’t know if it would be easy or hard to implement as I don’t know if the fall-through path for unrecognized keyboard codes is in Notepad++, meaning it should be easy to code, or if keystrokes are passed to Scintilla in hopes that they are recognized.My guess is that the unrecognized keystrokes go to Scintilla which then passes then on to Windows. Applications such as Notepad++ are supposed to look for things that they care about and pass the rest on to Scintilla which looks for things it cares about and passes the rest on to Windows. Windows’ keystroke handler will be looking for Alt-F4 and similar things and converting them into messages such as WM_QUIT to exit the application.
Thus, it may well not be at all easy for Notepad++ to have an
Ignore unrecognized keyboard Ctrl codes
setting. -
@mkupper said in Disable ASCII Control characters shortcuts?:
it may well not be at all easy for Notepad++ to have an Ignore unrecognized keyboard Ctrl codes setting.
Actually, it should be fairly easy.
And the script I linked to yesterday (and everyone since then has so far ignored) shows what would need to be done:
Prevent WM_CHAR codes for the control character range from reaching Scintilla, where they are processed by putting the corresponding character in the document.
By the way, people in the future will come read this thread, so it is best to post “correct” information.
This is not how to define a correct action tag to solve the problem; one example from above:
<Macro name="RemoveKey_Ctrl_Shift_X_CAN" Ctrl="yes" Alt="no" Shift="yes" Key="88"> <Action type="" message="" wParam="" lParam="" sParam="" /> </Macro>
The correct equivalent would be:
<Macro name="RemoveKey_Ctrl_Shift_X_CAN" Ctrl="yes" Alt="no" Shift="no" Key="88"> <Action type="0" message="2172" wParam="0" lParam="0" sParam="" /> </Macro>
Reference: https://npp-user-manual.org/docs/config-files/#macros:~:text=Attributes for the <Action> tag
-
-