GNOME Bugzilla – Bug 608400
enter is mapped to ^[OM in gnome-terminal
Last modified: 2015-01-20 22:10:21 UTC
The problem is that my gnome-terminal maps ENTER to ^[OM in vim. Reproduce: 1) open vim 2) press "i" insert mode 3) press CTRL-V 4) press ENTER you get ^[OM which is wrong, it should be ^M. Another way to reproduce: 1) type into a terminal "info cat" 2) hit "/" to do a search 3) type anything and hit ENTER you will get the error "[`ESC O m' is invalid]". Compare with the Ubuntu bug https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/511742 , it seems that not all Ubuntu users experience this bug but I do. My keyboard is FujitsuSiemens Amilo laptop.
-> vte
Confirming that it does send ESC O M ; but I get the same result in xterm (r278) and urxvt.
Bug 600659 comment 38 probably provides relevant technical info. The generated escape sequence might depend on: - App Cursor Keys mode - App Keypad mode - whether it's the normal Enter or keypad Enter - numlock status - xkb config I remember seeing similar issue a thousand times, but now I can't reproduce it with any terminals. I guess my (well, Saucy's) Xkb is the culprit, it is indeed broken in many ways.
> I guess my (well, Saucy's) Xkb is the culprit Correcting myself: I guess it's my brain-damaged laptop keyboard (see bug 600659 comment 67) that caused me not to see ESC O M -- that key incorrectly produces keycode 36 (the same as the "normal" Enter key), instead of 104. After remapping, I see a behavior that's exactly the same as xterm's, namely it produces ESC O M if and only if Application Keypad Mode is enabled and Numlock is off. (IMO anyone who thought that KP_Enter without numlock should do something different than Enter was totally nuts... but that's what xterm does, and so preferably that's what we should do too.)