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>


  • Are you using NP++ over wine/Linux by any chance?
    I noted the same thing on wine over gnome-shell. Didn’t see that on Windows.
    I also have some other keyboard issues on wine. Most annoying is that going to menu and pressing esc adds an ‘esc’ symbol to the text.
    I doubt it can be fixed from NP++ side but maybe someone else will have an idea.



  • Hello, Rick and gstavi,

    I’m not sure that this N++ behaviour is specially related to the use of Wine. As, unfortunately, this happens, also, on a classical Windows configuration :-((

    • Seemingly, only Scintilla commands ( SCI_... ) can have two different shortcuts. I, also, tried to add a third shortcut to the CTRL + V command. Unfortunately, as soon as you re-start N++, the Scintilla CTRL + V command has, again, its two default shortcuts :-(( . But, of course, you may, for instance, replace the default SHIFT + INSERT shortcut by your own shortcut. It works fine !

    • By default, Notepad++ uses the Numeric keyboard, for shortcuts, in three commands, ONLY, relative to the zoom feature :

      • CTRL + + ( SCI_ZOOMIN )

      • CTRL + - ( SCI_ZOOMOUT )

      • CTRL + / ( SCI_SETZOOM )

    After some tests, I realized that using the numeric keys, only, OR with the SHIFT key, for shortcuts, does NOT work ! In addition, it’s better not to use, too, the usual Windows ALT + Numeric digit key, which allows to insert any character, from its numeric ANSI or OEM code !

    So, the remaining combinations, really available for shortcuts, relative to the numeric keypad, should be, finally :

    CTRL                +  Key
    CTRL + SHIFT        +  Key
    CTRL + ALT          +  Key
    ALT + SHIFT         +  Key
    CTRL + ALT + SHIFT  +  Key
    

    Best Regards,

    guy038



  • The problem I described is not related to shortcuts (or Notepad++). It is related to wine.
    Running regular Notepad with ‘wine notepad’ ends with same results. ctrl-+ echos ‘+’ to document.
    I changed the zoom shortcuts to ctrl-- and ctrl-= to avoid it.

    Wine is great but not perfect.



  • @gstavi

    actually I don’t see this behavior with my linux installation.
    What I do have is an ESC when pressing escape and shift together,
    therefore I disabled all those asccii control chars using python script and startup.py
    file.

    editor.assignCmdKey(ord('E') + (KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('R') + (KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('Y') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('W') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('O') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('A') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('D') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('G') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('H') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('Z') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('X') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('C') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('V') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('B') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('N') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(ord('6') + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(189 + (KEYMOD.SHIFT + KEYMOD.CTRL << 16),2172)
    editor.assignCmdKey(7 + (KEYMOD.SHIFT << 16),2172)
    

    Maybe this can be useful for you as well.

    Btw, 2172 is SCI_NULL!

    Cheers
    Claudia



  • @Claudia-Frank

    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.



  • @Scott-Sumner

    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.

    Cheers
    Claudia



  • @Claudia-Frank

    That short script seems to solve my fat-finger issues; seems so obvious now… Thank you.



  • @Claudia-Frank

    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:



  • Hi Scott,

    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?

    Cheers
    Claudia



  • @Claudia-Frank

    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”).



  • @Scott-Sumner

    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…) :-)

    Cheers
    Claudia



  • Just noting that a similar thing is discussed in this thread as well:
    https://notepad-plus-plus.org/community/topic/11233/disable-ascii-control-characters-shortcuts


Log in to reply