Disable ASCII Control characters shortcuts?
-
Hi @guy038,
yes, of course, the assignCmdKey is an scintilla internal function only.
Not sure if I get your point so.Cheers
Claudia -
if you are still interested in getting the python script code working I assume
you need to install the python script plugin by using the msi package.
It seems that plugin manager has some serious problems with this plugin.Cheers
Claudia -
Just noting that a similar thing is discussed in this thread as well:
https://notepad-plus-plus.org/community/topic/12901/shortcut-map-num-performs-function-but-also-adds/8 -
-
So using the luascript addon with those start-up lines https://community.notepad-plus-plus.org/topic/11233/disable-ascii-control-characters-shortcuts/5 is still the only way to do this?
-
-
Well, there are several ways to achieve it, but if you mean can Notepad++ alone achieve it, the answer is No, it can’t.
The disadvantage of the LuaScript approach might be that no one has “looped” it, and every discrete key must be handled. Perhaps I would “loop” it, if I knew Lua…
Anyway, another approach where you don’t have to list every key is with a PythonScript, such as the one shown HERE.
-
@Alan-Kilborn said in Disable ASCII Control characters shortcuts?:
if you mean can Notepad++ alone achieve it, the answer is No, it can’t.
@Claudia-Frank’s suggestion in 2016 seems to work. The following will disable nearly all of the keyboards combinations in @Danny-Phan’s original list.
<Macro name="RemoveKey_Shift_Esc_ESC" Ctrl="no" Alt="no" Shift="yes" Key="27"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_E_ENQ" Ctrl="yes" Alt="no" Shift="no" Key="69"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_R_DC2" Ctrl="yes" Alt="no" Shift="no" Key="82"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_-_US" Ctrl="yes" Alt="no" Shift="yes" Key="189"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_6_RS" Ctrl="yes" Alt="no" Shift="yes" Key="54"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_A_SOH" Ctrl="yes" Alt="no" Shift="yes" Key="65"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_C_ETX" Ctrl="yes" Alt="no" Shift="yes" Key="67"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_D_EOT" Ctrl="yes" Alt="no" Shift="yes" Key="68"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_H_BS" Ctrl="yes" Alt="no" Shift="yes" Key="72"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_N_SO" Ctrl="yes" Alt="no" Shift="yes" Key="78"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_O_SI" Ctrl="yes" Alt="no" Shift="yes" Key="79"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_Y_EM" Ctrl="yes" Alt="no" Shift="yes" Key="89"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_V_SYN" Ctrl="yes" Alt="no" Shift="yes" Key="86"> <Action type="0" message="0" wParam="0" lParam="0" sParam="" /> </Macro>
Some keyboard combinations from the original list are now being used by v8.6.2. If you are using an older version of Notepad++ then include these to intercept these keyboard combinations:
<Macro name="RemoveKey_Ctrl_Shift_B_STX" Ctrl="yes" Alt="no" Shift="yes" Key="66"> <Action type="" message="" wParam="" lParam="" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_G_BEL" Ctrl="yes" Alt="no" Shift="yes" Key="71"> <Action type="" message="" wParam="" lParam="" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_W_ETB" Ctrl="yes" Alt="no" Shift="yes" Key="87"> <Action type="" message="" wParam="" lParam="" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_X_CAN" Ctrl="yes" Alt="no" Shift="yes" Key="88"> <Action type="" message="" wParam="" lParam="" sParam="" /> </Macro> <Macro name="RemoveKey_Ctrl_Shift_Z_SUB" Ctrl="yes" Alt="no" Shift="yes" Key="90"> <Action type="" message="" wParam="" lParam="" sParam="" /> </Macro>
I could not figure out how to handle
Ctrl+Pause/Break
. The code should be<Macro name="RemoveKey_Ctrl_Break_ETX" Ctrl="yes" Alt="no" Shift="no" Key="19"> <Action type="" message="" wParam="" lParam="" sParam="" /> </Macro>
but the
ETX
still shows up. I tried all eight combinations of Ctrl, Alt, Shift with key code 19 but none of them caughtCtrl+Pause/Break
. AsETX
shows up in the editor indicates it is getting a key code. Either it’s not code 19 or there is something else going on that’s special with Ctrl+Break. -
-
@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
-
-