Comment 41 for bug 96676

> I don't use mc, but have read that it stores key-definitions per $TERM
> with its learn-keys feature. That may be what's confusing it.

God, you are right!! I was looking at config in my home directory and was already going to say that it's not like that, when an idea striked me that maybe there's some system-wide config. And yet is it, /etc/mc/mc.lib:

# Sequences below are for Konsole, which also sets TERM=xterm

So that's why I'm seeing it working in an unexpected way when terminfo entries are correct! So for anyone interested, there are two choices:

1) recompile vte with this change reverted:
2) create myxterm.ti like I displayed below (or grab full terminfo.src at, mentioned earlier by Thomas), compile it with tic, then add appropriate entries to /etc/mc/mc.lib, using \e[1;2P...\e[1;2S for xterm and \eO1;2P...\eO1;2S for gnome-terminal (you can specify both). Sadly, if I'm not missing something, only one of these notations (xterm or gnome-terminal) can be specified in myxterm.ti file (infocmp and ncurses seem to use only one of them).

The problem with solution 1 is that xterm will still stay misunderstood on your system (though I'm not using xterm, thus I'm personally going with number 1 at the moment, to retain compatibility with konsole).

The problem with solution 2 is that xterm, gnome-terminal and konsole are all three mutually incompatible in this regard. You can make mc understand all three, but it's not going to be universal and might not work with other programs. :-/ Now, to me it seems that current vte behavior is a bug and should match xterm. And most of all konsole should do that too, or stop pretending to be xterm!

Below is an example of my final myxterm.ti:

xterm-kfpc-13-16-xterm|kf13..kf16 for xterm,

xterm-kfpc-13-16-gterm|kf13..kf16 for gnome-terminal,

xterm|X11 terminal emulator with correct kf-sequences,

Here you can choose between xterm and gnome-terminal in the use statement. Further comments are welcome, and I hope this will help workaround the problem for others too.