Comment 41 for bug 96676

Revision history for this message
Alexey Borzenkov (snaury) wrote : Re: [feisty] function keys don't work in gnome-terminal

> 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:

...
[terminal:xterm]
...
# Sequences below are for Konsole, which also sets TERM=xterm
kf11=\eO2P
kf12=\eO2Q
kf13=\eO2R
kf14=\eO2S
...

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: http://svn.gnome.org/viewcvs/vte/trunk/src/keymap.c?r1=1341&r2=1391
2) create myxterm.ti like I displayed below (or grab full terminfo.src at invisible-island.net, 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,
 kf13=\E[1;2P,
 kf14=\E[1;2Q,
 kf15=\E[1;2R,
 kf16=\E[1;2S,

xterm-kfpc-13-16-gterm|kf13..kf16 for gnome-terminal,
 kf13=\EO1;2P,
 kf14=\EO1;2Q,
 kf15=\EO1;2R,
 kf16=\EO1;2S,

xterm|X11 terminal emulator with correct kf-sequences,
 use=xterm-kfpc-13-16-xterm,
 use=xterm-debian,

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.