Shortcut map Num+ performs function but also adds '+'
This may be a newbie problem. I attempted to add Numeric keypad ‘+’ as an additional shortcut for SCI_LINECOPY. It does work, sort-of. The problem is that after copying the line, a ‘+’ is also entered afterwards. The net effect of the operation is that the line is selected, copied to the clipboard, and then the ‘+’ is entered in front of the previously selected line. Am I missing a step that would prevent the original meaning of ‘Num +’ from executing?
In addition, if I add a third key, Num *, to SCI_PASTE, I can see the definition and it works in the session that I defined it. When I exit and run NP++ again the third shortcut has disappeared and no longer works.
I’m not sure if this is relevant, but there appears to be a conflict in the mapping of Ctl-Alt-Shift-F.
This is the section I am seeing in shortcuts.xml that appears related to the modifications I’m attempting.
<ScintillaKeys> <ScintKey ScintID="2179" menuCmdID="42005" Ctrl="yes" Alt="no" Shift="no" Key="86"> <NextKey Ctrl="no" Alt="no" Shift="yes" Key="45" /> <NextKey Ctrl="no" Alt="no" Shift="no" Key="106" /> </ScintKey> <ScintKey ScintID="2455" menuCmdID="0" Ctrl="yes" Alt="no" Shift="yes" Key="88"> <NextKey Ctrl="no" Alt="no" Shift="no" Key="107" /> </ScintKey> </ScintillaKeys>
Occasionally I fat-finger something and end up with a control character of some sort in my text. For example, I remember recently getting “CAN” or “DC1” or “ETB” in white surrounded by a black border when I did this. Is there a way to assign all non-normal (define normal as something on a key that actually appears the same way when typed) and non-shortcutmapper-mapped keys to SCI_NULL? This would stop the fat-finger mistakes.
Clearly one can do it as Claudia has, but that sort of becomes a maintenance nightmare to do each keycombo individually…
Linux has so many flavors and there are so much variety in the background infrastructure that every machine may act differently.
At work, under ubuntu 14.04 with gnome-shell (and whoever knows what else) I see the behavior I described and also some GUI artifacts like shrunken title bars for windows.
At home under Linux Mint I don’t see the GUI artifacts. Don’t remember if the keyboard issues are there.
after spent a couple of minutes thinking about it, I don’t see
a built-in way or using a scripting plugin to achieve this.
Another approach might be to register a charadded callback function
and check if char is < 32. E.g.
def CHARADDED(args): c = args['ch'] if c < 32 and c not in [9,10,13]: editor.deleteBack() editor.callbackSync(CHARADDED,[SCINTILLANOTIFICATION.CHARADDED])
Or hooking (maybe it isn’t required but getting handle and search controls)
npp might be working as well, something like
first set all key combination to sci_null and then get what is configured as editor shortcut
from npp and set it again.
First question would be, how to handle shortcut map changes during runtime.
Also, not sure how easy this can be done but I will give it a try when back from work.
That short script seems to solve my fat-finger issues; seems so obvious now… Thank you.
I just noticed when I accidentally typed ctrl+backspace that a “funny character” was inserted into my document. After a little investigation I changed the relevant line in the script above to:
if (c < 32 and c not in [9,10,13]) or c == 0x7F:
ahh - one of my wanted to test but forgot about it totally.
Hmm, don’t have it on my side but thx for enhancing anyway. :-)
Normal config defines ctrl+backspace as delete word left.
Do you use sync or async callback? Could it be that backup functionality
is jumping in? Another py script running in parallel?
I have no shortcut defined for SCI_DELWORDLEFT.
Additionally, I have no shortcut for the Ctrl+Backspace combination (tested by setting one for a command that has none, and saw “no conflicts” result).
Using the script as it was provided (thus “callbackSync”).
and that’s the reason why I don’t have it. De-assigning the shortcut and et voila
I do have the same BS (no, not for Bull…) :-)
Just noting that a similar thing is discussed in this thread as well: