Here's an update. I'm describing what I see on Ubuntu 25.10.

The kernel's built-in keymap (drivers/tty/vt/defkeymap.map) hasn't
changed.  It defines 20 different escape sequences, and has a strong
off-by-10 vibe (e.g. Shift+F3 produces the 13th of these sequences).
Shift+F1, F11 and Shift+F11 all generate the same sequence, and so do
Shift+F2, F12 and Shift+F12.

kbd / console-setup has slightly changed.  It no longer ships its own
keymaps, but rather "loadkeys" launches "ckbcomp" which converts X11's xkb
definition files to the console's format.

It's a nice move and I do appreciate that the console now uses the
better-maintained xkb maps.  It hopefully also provides more consistency.
The "us" and "ru" keymap no longer differ in the handling of function keys,
and I assume all the keymaps are unified now in this regard.

(I have no information on other distros, I don't know if others might use a
different loadkeys / keyboard data implementation.)

The maps loaded by my loadkeys (via ckbcomp), however, do not agree with
the kernel's built-in map.  They do whatever the "us" layout did for me 13
years ago.

There are still only 20 different escape sequences, the same ones as in the
bulit-in map.  They are laid out off-by-12, to the keys F1..F12 and
Shift+F1..Shift+F8.  Shift+F9..Shift+F12 do nothing.

Terminfo also describes the very same 20 different escape sequences for
kf1..kf20, whereas there's no kf21 and above capability.

---

So, there are two different possible layouts.

The kernel's built-in, presumably used by minimal or embedded Linux
systems, ones where the console is not set up with "loadkeys", is fully
functional for mc's purposes.  However, we'd need to have an exception in
the code to know that terminfo's kf13 etc. entries are off by 10, rather
than by 12 as for graphical terminals. If we have to have such hacks on top
of terminfo then what's the purpose? We could just hardcode the keys and be
done with it (as we currently do).

The ones loaded by "loadkeys" (at least on Ubuntu 25.10; again: not sure
about other distros) could be handled by mc out of the box without any
special hack / exception, since the same offset of 12 is used as for any
other terminal. However, Shift+F9 (pulldown menu at its previous state) and
Shift+F10 (quit without updating the working directory) are unavailable.

---

What should be done to fix the situation:

Agree on 24 different escape sequences, and their unique assignment to the
F1..F12 and Shift+F1..Shift+F12 keys.

Then make sure that the kernel's hardcoded table, the tables loaded by
loadkeys (generated via ckbcomp, or loaded from its own data files, or
whatever), and terminfo (up to kf24) all define these.

For the best compatibility, I think the right choice is to keep what's
already defined in terminfo, and with the usual off-by-12 mapping, the keys
loaded by loadkeys.  Add four new entries for the current gaps of
Shift+F9..Shift+F12 (terminfo: kf21..kf24).  The only component receiving a
backwards incompatible change would be the kernel's hardwired table; for
downstream distros that do run "loadkeys" this doesn't even matter.


e.

Reply via email to