Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Disable ASCII Control characters shortcuts?

    Help wanted · · · – – – · · ·
    5
    17
    34027
    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.
    • Danny Phan
      Danny Phan last edited by

      These are a list of shortcuts for ASCII control characters I’ve found so far. I wish to keep all of them from appearing while I’m typing. I can accidentally hit these shortcuts when I’m trying to use other shortcuts like Ctrl + Z or Ctrl + V, for example. I’m using Windows and I could find no way to remove these from the shortcut mapper.

      ~ Shift + Esc = (ESC)
      ~ Ctrl + E = (ENQ)
      ~ Ctrl + R = (DC2)
      ~ Ctrl + Pause\Break = (ETX)
       ~ Ctrl + Shift + Y = (EM)
      ~ Ctrl + Shift + W = (ETB)
      ~ Ctrl + Shift + O = (SI)
      ~ Ctrl + Shift + A = (SOH)
      ~ Ctrl + Shift + D = (EOT)
      ~ Ctrl + Shift + G = (BEL)
      ~ Ctrl + Shift + H = (BS)
      ~ Ctrl + Shift + Z = (SUB)
      ~ Ctrl + Shift + X = (CAN)
      ~ Ctrl + Shift + C = (ETX)
      ~ Ctrl + Shift + v = (SYN)
      ~ Ctrl + Shift + B = (STX)
      ~ Ctrl + Shift + N = (SO)
      ~ Ctrl + Shift + 6 + (RS)
      ~ Ctrl + Shift + -(Dash) = (US)

      1 Reply Last reply Reply Quote 0
      • Scott Sumner
        Scott Sumner last edited by

        I find something along these lines an excellent feature suggestion!

        1 Reply Last reply Reply Quote 0
        • dail
          dail last edited by

          Couldn’t agree more. Don’t know how many times I’ve done this. Especially Ctrl+Shift+Z.

          1 Reply Last reply Reply Quote 0
          • Claudia Frank
            Claudia Frank last edited by

            Well, kind of a hack, you could simply assign shortcuts to no action macro, couldn’t you?
            Something like

                <Macro name="RemoveControlCharSUB" Ctrl="yes" Alt="no" Shift="yes" Key="90">
                    <Action type="" message="" wParam="" lParam="" sParam="" />
                </Macro>
            

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 0
            • dail
              dail last edited by

              I’m going to shamelessly promote my new plugin. If you install the plugin and put the following code in the startup script it will get rid of most of these shortcuts.

              editor:AssignCmdKey(string.byte('E'), SCMOD_CTRL, SCI_NULL)
              editor:AssignCmdKey(string.byte('R'), SCMOD_CTRL, SCI_NULL)
              editor:AssignCmdKey(string.byte('E'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('Y'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('W'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('O'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('A'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('D'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('G'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('H'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('Z'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('X'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('C'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('V'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('B'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('N'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              editor:AssignCmdKey(string.byte('6'), SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL)
              
              Claudia Frank 1 Reply Last reply Reply Quote 1
              • Claudia Frank
                Claudia Frank @dail last edited by

                @dail there is nothing to shame about, you offer a new plugin and a solution to a problem.
                Sounds like a successful day to me ;-)
                And you remembered me about a function AssignCmdKey which I have nearly forgotten.

                So a python script would look like this

                editor.assignCmdKey(ord('E')+(2<<16),2172)
                editor.assignCmdKey(ord('R')+(2<<16),2172)
                editor.assignCmdKey(ord('Y')+(3<<16),2172)
                editor.assignCmdKey(ord('W')+(3<<16),2172)
                editor.assignCmdKey(ord('O')+(3<<16),2172)
                editor.assignCmdKey(ord('A')+(3<<16),2172)
                editor.assignCmdKey(ord('D')+(3<<16),2172)
                editor.assignCmdKey(ord('G')+(3<<16),2172)
                editor.assignCmdKey(ord('H')+(3<<16),2172)
                editor.assignCmdKey(ord('Z')+(3<<16),2172)
                editor.assignCmdKey(ord('X')+(3<<16),2172)
                editor.assignCmdKey(ord('C')+(3<<16),2172)
                editor.assignCmdKey(ord('V')+(3<<16),2172)
                editor.assignCmdKey(ord('B')+(3<<16),2172)
                editor.assignCmdKey(ord('N')+(3<<16),2172)
                editor.assignCmdKey(ord('6')+(3<<16),2172)
                editor.assignCmdKey(189+(3<<16),2172)
                editor.assignCmdKey(27+(1<<16),2172)
                
                editor.assignCmdKey(19+(2<<16),2172)  # this seems not to work although 19 should be the key code of break key
                

                Cheers
                Claudia

                1 Reply Last reply Reply Quote 1
                • dail
                  dail last edited by

                  Yeah I’ve always been a fan of the PythonScript plugin (even stole code from that project :)). However for alot of my uses it was over kill in terms of RAM and initialization time to make it worth it.

                  Claudia Frank 1 Reply Last reply Reply Quote 0
                  • Claudia Frank
                    Claudia Frank @dail last edited by

                    That’s the beauty of having multiple programming/scripting languages, isn’t it. ;-)
                    Having lua as npp scripting extension can force me to learn more about it because
                    it’s also an extension to wireshark afaik.

                    Thank you
                    Claudia

                    1 Reply Last reply Reply Quote 0
                    • Claudia Frank
                      Claudia Frank last edited by

                      ok this should do the trick for CTRL+break

                      editor.assignCmdKey(3+(KEYMOD.CTRL << 16),2172)
                      

                      Cheers
                      Claudia

                      1 Reply Last reply Reply Quote 0
                      • Claudia Frank
                        Claudia Frank last edited by

                        After testing again, I saw that SHIFT+ESC still worked, strange.
                        So figured out, that

                        editor.assignCmdKey(27+(1<<16),2172)
                        

                        is wrong and should be

                        editor.assignCmdKey(7+(1<<16),2172)
                        

                        instead. Hmm…

                        So the full list more user friendly

                        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)
                        editor.assignCmdKey(3 + (KEYMOD.CTRL << 16),2172)
                        

                        Cheers
                        Claudia

                        1 Reply Last reply Reply Quote 0
                        • Claudia Frank
                          Claudia Frank last edited by

                          Of course it must be

                          After testing again, I saw that SHIFT+ESC still didn’t work, strange.

                          Cheers
                          Claudia

                          1 Reply Last reply Reply Quote 0
                          • Danny Phan
                            Danny Phan last edited by Danny Phan

                            Thanks! It worked out brilliantly. This was something that always bothered me about Notepad++. I’m not too big a coder myself, and I’m definitely sure I’ll never use those control characters. Glad I finally got rid of these shortcuts.

                            I got dail’s plugin working. I couldn’t get Claudia’s python code to work though. I downloaded Python Script 1.0.6 from the plugins manager and upon pressing Show Console, I got an Unknown Exception error message. Pressing the Show Console button again allowed me to popup the console, but I suspect the reason why the console isn’t working because of the unknown exception.

                            Running
                            editor:AssignCmdKey(string.byte(‘E’), SCMOD_CTRL, SCI_NULL)
                            in the console did not change my key assignments.

                            In addition to dail’s code, you should also add these 3 lines. I came up with this code thanks to Claudia’s previous code.
                            <pre><code>
                            editor:AssignCmdKey(3, SCMOD_CTRL, SCI_NULL) – CTRL + PAUSE/BREAK
                            editor:AssignCmdKey(7, SCMOD_SHIFT, SCI_NULL) – SHIFT + ESC
                            editor:AssignCmdKey(189, SCMOD_CTRL + SCMOD_SHIFT, SCI_NULL) – Ctrl + Shift + -(Dash)
                            </pre></code>

                            On a side note, I can’t get the markdown for codeblocks to show up in a post’s preview.

                            Claudia Frank 1 Reply Last reply Reply Quote 1
                            • dail
                              dail last edited by dail

                              Running editor:AssignCmdKey(string.byte(‘E’), SCMOD_CTRL, SCI_NULL) in the console did not change my key assignments.

                              That’s weird. It works for me. Maybe there is some other plugin or keyboard configuration that is messing with it.

                              Thanks for those extra 3 shortcuts. They worked fine for me!

                              Also, to fully get rid of those ASCII control codes, you should probably disable those on both “views”. So instead of using editor you should set the shortcut on both editor1 and editor2 instead; for example…

                              editor1:AssignCmdKey(3, SCMOD_CTRL, SCI_NULL)
                              editor2:AssignCmdKey(3, SCMOD_CTRL, SCI_NULL)
                              

                              I believe this would also apply to the PythonScript plugin.

                              1 Reply Last reply Reply Quote 0
                              • guy038
                                guy038 last edited by

                                Hi Danny and All,

                                Once you inhibited these shortcuts, you’re still able to write control characters, in your text, with the classical Windows method !

                                • Hit down the ALT key

                                • While keeping the ALT key pressed, type, on the NUMERIC keypad, the three digits, of a number between 001 and 031

                                • Release all the keys => the appropriate Control character should be inserted, at the current cursor position

                                For instance : Press ALT and 0 , 1 , 8 would write the 18th letter of the alphabet ( the letter R ) => DC2

                                So :

                                ALT  +  0 0 1    =>    SOH      ( A )
                                ALT  +  0 0 2    =>    STX      ( B )
                                ALT  +  0 0 3    =>    ETX      ( C )
                                ALT  +  0 0 4    =>    EOT      ( D )
                                ALT  +  0 0 5    =>    ENQ      ( E )
                                ALT  +  0 0 6    =>    ACK      ( F )
                                ALT  +  0 0 7    =>    BEL      ( G )
                                ALT  +  0 0 8    =>    BS       ( H )
                                ALT  +  0 0 9    =>    TAB      ( I )
                                ALT  +  0 1 0    =>    LF       ( J )
                                ALT  +  0 1 1    =>    VT       ( K )
                                ALT  +  0 1 2    =>    FF       ( L )
                                ALT  +  0 1 3    =>    CR       ( M )
                                ALT  +  0 1 4    =>    SO       ( N )
                                ALT  +  0 1 5    =>    SI       ( O )
                                ALT  +  0 1 6    =>    DLE      ( P )
                                ALT  +  0 1 7    =>    DC1      ( Q )
                                ALT  +  0 1 8    =>    DC2      ( R )
                                ALT  +  0 1 9    =>    DC3      ( S )
                                ALT  +  0 2 0    =>    DC4      ( T )
                                ALT  +  0 2 1    =>    NAK      ( U )
                                ALT  +  0 2 2    =>    SYN      ( V )
                                ALT  +  0 2 3    =>    ETB      ( W )
                                ALT  +  0 2 4    =>    CAN      ( X )
                                ALT  +  0 2 5    =>    EM       ( Y )
                                ALT  +  0 2 6    =>    SUB      ( Z )
                                ALT  +  0 2 7    =>    ESC      (   )
                                ALT  +  0 2 8    =>    FS       (   )
                                ALT  +  0 2 9    =>    GS       (   )
                                ALT  +  0 3 0    =>    RS       (   )
                                ALT  +  0 3 1    =>    US       (   )
                                

                                Only, the control character NULL can’t be written, with that method. Instead, you’ll use the ASCII Insertion Panel ( Menu Edit - Character Panel ! )

                                Cheers,

                                guy038

                                Claudia Frank 1 Reply Last reply Reply Quote 0
                                • Claudia Frank
                                  Claudia Frank @guy038 last edited by

                                  Hi @guy038,

                                  yes, of course, the assignCmdKey is an scintilla internal function only.
                                  Not sure if I get your point so.

                                  Cheers
                                  Claudia

                                  1 Reply Last reply Reply Quote 0
                                  • Claudia Frank
                                    Claudia Frank @Danny Phan last edited by

                                    @Danny-Phan

                                    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

                                    1 Reply Last reply Reply Quote 0
                                    • Scott Sumner
                                      Scott Sumner last edited by

                                      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

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post
                                      Copyright © 2014 NodeBB Forums | Contributors