• Login
Community
  • Login

Shortcut map Num+ performs function but also adds '+'

Scheduled Pinned Locked Moved General Discussion
14 Posts 5 Posters 10.9k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C
    Claudia Frank @gstavi
    last edited by Claudia Frank Dec 18, 2016, 10:34 PM Dec 18, 2016, 10:33 PM

    @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

    S 1 Reply Last reply Dec 19, 2016, 12:45 AM Reply Quote 0
    • S
      Scott Sumner @Claudia Frank
      last edited by Dec 19, 2016, 12:45 AM

      @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…

      C 1 Reply Last reply Dec 19, 2016, 3:16 PM Reply Quote 0
      • G
        gstavi
        last edited by Dec 19, 2016, 6:19 AM

        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.

        1 Reply Last reply Reply Quote 0
        • C
          Claudia Frank @Scott Sumner
          last edited by Dec 19, 2016, 3:16 PM

          @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

          S 2 Replies Last reply Dec 19, 2016, 4:03 PM Reply Quote 1
          • S
            Scott Sumner @Claudia Frank
            last edited by Dec 19, 2016, 4:03 PM

            @Claudia-Frank

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

            1 Reply Last reply Reply Quote 0
            • S
              Scott Sumner @Claudia Frank
              last edited by Feb 6, 2017, 4:06 PM

              @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:

              C 1 Reply Last reply Feb 6, 2017, 4:30 PM Reply Quote 0
              • C
                Claudia Frank @Scott Sumner
                last edited by Feb 6, 2017, 4:30 PM

                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

                S 1 Reply Last reply Feb 6, 2017, 4:47 PM Reply Quote 0
                • S
                  Scott Sumner @Claudia Frank
                  last edited by Feb 6, 2017, 4:47 PM

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

                  C 1 Reply Last reply Feb 6, 2017, 4:52 PM Reply Quote 0
                  • C
                    Claudia Frank @Scott Sumner
                    last edited by Feb 6, 2017, 4:52 PM

                    @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

                    1 Reply Last reply Reply Quote 1
                    • S
                      Scott Sumner
                      last edited by Mar 3, 2017, 2:38 PM

                      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

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors