Skip to content

Numeric keypad: the Enter key does not generate newline #2774

Open

Description

@developer1105

System: Arch Linux

Data about micro:
Version: 2.0.11
Commit hash: 225927b
Compiled on August 09, 2022

Problem: when pressing the Enter key (numeric keypad) it does not generate newline (as expected).
All the other keys in the numeric keypad work fine (both with numlock on, and with numlock off).

Activity

  1. zyedidia commented on Mar 13, 2023

    @zyedidia
    Member

    If you use the > raw command does pressing the enter key on the keypad send an escape sequence? (And if so what does it send)

  2. mmahmoudian commented on Apr 14, 2023

    @mmahmoudian

    Yes, it sends EventKey: Ctrl-j: "\n"

    image

  3. developer1105 commented on Apr 18, 2023

    @developer1105
    Author
  4. developer1105 commented on Apr 18, 2023

    @developer1105
    Author

    Ok, understood! Just sending some info that might be of interest:

    Using 'xev' on command line to differentiate keys:
    Normal => keycode 36 (keysym 0xff0d, Return)
    Keypad => keycode 104 (keysym 0xff8d, KP_Enter)

  5. mmahmoudian commented on Apr 19, 2023

    @mmahmoudian

    These are what I get from xev when pressing and releasing normal Enter and then numpad enter:

    KeyPress event, serial 40, synthetic NO, window 0x5800001,
        root 0x6ed, subw 0x0, time 505468131, (-218,923), root:(3233,1808),
        state 0x10, keycode 36 (keysym 0xff0d, Return), same_screen YES,
    "   XLookupString gives 1 bytes: (0d) "
    "   XmbLookupString gives 1 bytes: (0d) "
        XFilterEvent returns: False
    
    KeyRelease event, serial 40, synthetic NO, window 0x5800001,
        root 0x6ed, subw 0x0, time 505468179, (-218,923), root:(3233,1808),
        state 0x10, keycode 36 (keysym 0xff0d, Return), same_screen YES,
    "   XLookupString gives 1 bytes: (0d) "
        XFilterEvent returns: False
    
    KeyPress event, serial 40, synthetic NO, window 0x5800001,
        root 0x6ed, subw 0x0, time 505468923, (-218,923), root:(3233,1808),
        state 0x10, keycode 104 (keysym 0xff8d, KP_Enter), same_screen YES,
    "   XLookupString gives 1 bytes: (0d) "
    "   XmbLookupString gives 1 bytes: (0d) "
        XFilterEvent returns: False
    
    KeyRelease event, serial 40, synthetic NO, window 0x5800001,
        root 0x6ed, subw 0x0, time 505468971, (-218,923), root:(3233,1808),
        state 0x10, keycode 104 (keysym 0xff8d, KP_Enter), same_screen YES,
    "   XLookupString gives 1 bytes: (0d) "
        XFilterEvent returns: False
    

    The following is the diff. I've just added two lines to the beginning of each buffer to clarify which one is from which key

    image

  6. developer1105 commented on Aug 15, 2023

    @developer1105
    Author

    I am using this as a workaround:

    xmodmap -e "keycode 104 = Return"

  7. mmahmoudian commented on Nov 30, 2023

    @mmahmoudian

    @developer1105 may I ask why this was closed?

  8. developer1105 commented on Feb 19, 2024

    @developer1105
    Author

    One thing I noticed recently, is that this problem happens in IceWM (the window manager I was using some time ago).

    In Cinnamon this does not happen. Both enter keys (alphabetic keyboard and numeric keyboard) generate newlines.

  9. developer1105 commented on Feb 19, 2024

    @developer1105
    Author

    I probably closed it by mistake. Should I reopen it?

  10. mmahmoudian commented on Feb 19, 2024

    @mmahmoudian

    I probably closed it by mistake. Should I reopen it?

    Yes, I tested it now with 2.0.13 (commit hash 68d88b5) and still cannot insert new line with numpad enter key

  11. Andriamanitra commented on Feb 19, 2024

    @Andriamanitra
    Collaborator

    As a workaround you can add whatever event you get to your ~/.config/micro/bindings.json (check the actual key code your keyboard is sending with > raw as I'm not entirely sure if Ctrl-j is some kind of standard that some keyboards or operating systems follow):

        "Ctrl-j": "InsertNewline",
  12. mmahmoudian commented on Feb 20, 2024

    @mmahmoudian

    @Andriamanitra kiitos, mutta se ei ole sopi ;)

    Because a user might bind Ctrl-j to an actual legit action already. Therefore I suggest opening the issue in order to getting it fixed. Afterall terminal gets the key, nvim, emacs (interminal), and etc are accepting numpad enter. The only exception I've found in terminal is nano which registers Ctrl-j

  13. developer1105 commented on Mar 18, 2024

    @developer1105
    Author

    Ok, I guess this issue is properly reopened now...

  14. developer1105 commented on May 1, 2025

    @developer1105
    Author

    I noticed that:

    When starting micro from Alacritty, numkeypad Enter doesn't work.

    With other terminals, like xterm, for instance, it works.

  15. synth-ruiner commented on Jul 21, 2026

    @synth-ruiner

    Same here, I'm an Alacritty user and noticed this. I tried a couple of other terminal emulators (gnome-terminal, cool-retro-term) and numpad enter worked fine. I wonder if this is a general Alacritty problem, I'll go and have a look at their issue tracker.

    Micro version 2.0.15-5, Alacritty 0.17.0.

  16. Andriamanitra commented on Sep 20, 2026

    @Andriamanitra
    Collaborator

    #4174 should fix this for modern terminals. On old terminals that don't support advanced keyboard handling we can't do much about this -- if the terminal gives us the same event for two different key presses we have no way to differentiate between them -- so you will have to rely on a workaround like xmodmap or terminal-specific custom keyboard mapping settings.

  17. iamthedesert commented on Nov 3, 2026

    @iamthedesert

    Until a more general fix is implemented for any Alacritty users stumbling into this thread, add the following keybind to /home/user/.config/alacritty/alacritty.toml

    [keyboard]
    bindings = [
        { key = "NumpadEnter", chars = "\x0d" }
    ]
    

    adapted from alacritty/alacritty#3720 (comment) for alacritty 0.17.0-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions