keyboard shortcuts - What do Ctrl-J, Ctrl-M and Ctrl-I mean in Microsoft Notepad?

07
2014-07
  • Ram Rachum

    I just noticed, by a fluke, that when hitting Ctrl+J or Ctrl+M in Microsoft Notepad (on Windows 7), it has and same effect as Enter.

    Hitting Ctrl+I has and same effect as Tab.

    This has no practical consequences for me... But I'm just curious, why do these key combinations produce this output? Why Ctrl+J for Enter?

  • Answers
  • Geoff

    Take a look at this table; the underlying character code for Ctrl+M happens to be (decimal) 13, which is the same as the enter key. The same thing goes for the tab (Ctrl+I), and so on. Ctrl+G is the BEL character, used to alert a remote operator; it still works that way in some terminal programs.

    This dates from early telecommunication days when those characters were used for 'out of band' signalling, because they're not printing characters.

    The Wikipedia page has an interesting write up on it all.


  • Related Question

    windows 7 - Ctrl+Backspace inserts a small box instead of erasing
  • Questioner

    When I press Ctrl+Backspace, sometimes a small square is inserted, instead of the entire word being erased. If I copy and paste the character here, I get this: ``. But it doesn’t look quite like that in the text box – there it’s just a plain white rectangle with a 1px black border.

    The problem only happens in some text boxes; in others the shortcut works like it should.

    • Start menu search box: works
    • Notepad: doesn’t work

      small box created from Ctrl+Backspace in Notepad

    • Notepad2: works
    • Firefox: works

    I’m running Windows 7 x64.


  • Related Answers
  • Jared Harley

    The "box" you're seeing is what is known as a control character. The box is displayed because, as you've discovered, not all programs handle the ctrl+backspace to remove a word.

    This control character is one of 33 "non-printing" characters in the 128 character ASCII character-encoding scheme.

  • Nulano

    You can fix this behavior by overriding the Ctrl+Backspace shortcut using AutoHotkey. Save the following code in a plain text file with the given filename and extension, then launch the script with AutoHotkey:

    FixCtrlBackspace.ahk

    ; how to write scripts: http://www.autohotkey.com/docs/
    
    #IfWinActive ahk_class CabinetWClass ; File Explorer
        ^Backspace::
    #IfWinActive ahk_class Notepad
        ^Backspace::
        Send ^+{Left}{Backspace}
    #IfWinActive
    
    ; source and context: http://superuser.com/a/636973/124606
    
    ; relevant documentation links:
    ; writing hotkeys
    ; http://www.autohotkey.com/docs/Hotkeys.htm
    ; list of key codes (including Backspace)
    ; http://www.autohotkey.com/docs/KeyList.htm
    ; the #IfWinActive directive
    ; http://www.autohotkey.com/docs/commands/_IfWinActive.htm
    ; the Send command
    ; http://www.autohotkey.com/docs/commands/Send.htm
    

    You may find it easier to download this script file from GitHub, rather than creating the file and pasting in its contents yourself.

    To launch this script automatically on startup, add a shortcut to it to the Startup folder in your Start menu, as described in Run a program automatically when Windows starts.

    The basic idea of the script is this:

    ^Backspace:: Send ^+{Left}{Backspace}
    

    This changes the Ctrl+Backspace shortcut in all programs so that it is equivalent to pressing Ctrl+Shift+, to select the previous word, and then Backspace, to delete it.

    This select-and-delete workaround, while better than typing a box, is brittle. It’s safer to not enable this shortcut in programs in which Ctrl+Backspace already works. That’s why I use #IfWinActive to limit the hotkey to only programs that I know don't support that shortcut.

  • djhowell

    Found this on an MSDN blog...

    A few people in the early days of the Internet Explorer group used the Brief editor, which uses Ctrl+Backspace as the shortcut key to delete the previous word, and they liked it so much that one of them added it to the autocomplete handler. Therefore, any edit control that uses SHAutoComplete will gain this secret Ctrl+Backspace hotkey.

    So it sounds like if the application does not use SHAutoComplete it will not support the feature unless it has been explicitly added by the application's author.

    P.S. control-delete removes the word ahead of the cursor

  • th3dude

    Not all applications handle keyboard shortcuts the same. Notepad doesn't seem to handle this key combination and handles it in its own way.