micro icon indicating copy to clipboard operation
micro copied to clipboard

Numeric keypad: the Enter key does not generate newline

Open developer1105 opened this issue 2 years ago • 14 comments

System: Arch Linux

Data about micro: Version: 2.0.11 Commit hash: 225927b9 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).

developer1105 avatar Mar 12 '23 22:03 developer1105

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)

zyedidia avatar Mar 13 '23 04:03 zyedidia

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

image

mmahmoudian avatar Apr 14 '23 16:04 mmahmoudian

The keyboard is connected to a Intel NUC, maybe this is the source of incompatibility

Em sex., 14 de abr. de 2023 às 13:14, Mehrad Mahmoudian < @.***> escreveu:

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

[image: image] https://user-images.githubusercontent.com/390889/232099180-d0f4c904-2810-4020-acf9-a79739380127.png

— Reply to this email directly, view it on GitHub https://github.com/zyedidia/micro/issues/2774#issuecomment-1508908125, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQAYBAF4FRJE27G2AKXXSKTXBFZVPANCNFSM6AAAAAAVYMDZHU . You are receiving this because you authored the thread.Message ID: @.***>

developer1105 avatar Apr 18 '23 17:04 developer1105

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)

developer1105 avatar Apr 18 '23 20:04 developer1105

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

mmahmoudian avatar Apr 19 '23 08:04 mmahmoudian

I am using this as a workaround:

xmodmap -e "keycode 104 = Return"

developer1105 avatar Aug 15 '23 13:08 developer1105

@developer1105 may I ask why this was closed?

mmahmoudian avatar Nov 30 '23 08:11 mmahmoudian

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.

developer1105 avatar Feb 19 '24 13:02 developer1105

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

developer1105 avatar Feb 19 '24 13:02 developer1105

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

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

mmahmoudian avatar Feb 19 '24 15:02 mmahmoudian

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",

Andriamanitra avatar Feb 19 '24 23:02 Andriamanitra

@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

mmahmoudian avatar Feb 20 '24 13:02 mmahmoudian

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

developer1105 avatar Mar 18 '24 17:03 developer1105

I noticed that:

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

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

developer1105 avatar May 01 '25 21:05 developer1105