Comment 38 for bug 96676

Revision history for this message
Thomas Dickey (dickey-his) wrote : Re: [Bug 96676] Re: [feisty] function keys don't work in gnome-terminal

On Tue, 23 Oct 2007, Alexey Borzenkov wrote:

> I'd like to second steviant's request. For a long time this bug forced
> me to use konsole instead of gnome-terminal, just for ability to press
> Shift+F4. Unfortunately with konsole Shift+Left/Shift+Right don't work
> (which work under gnome-terminal), so editing text files is not of much
> use. It's really annoying that I can get one part of a functionality
> with only one terminal and the other half only with other. :-/

It sounds as if someone's trying to use TERM=xterm for all three,
which won't work.

> I've just downloaded ncurses sources and finally found why Thomas
> Dickey's example didn't make sense (and didn't compile). There's no
> xterm-xf86-v44. Ubuntu actually uses xterm-debian. So the first attempt

terminfo.src change history shows it's been in the sources a while:

# 2004-06-26
# * add mlterm -TD
# * add xterm-xf86-v44 -TD
# * modify xterm-new aka xterm-xfree86 to accommodate luit, which relies
# on G1 being used via an ISO-2022 escape sequence (report by
# Juliusz Chroboczek) -TD
# * add 'hurd' entry -TD
#
> was like this:
>
> $ cat >myxterm.ti
> xterm|X11 terminal emulator with correct kf-sequences,
> kf13=\EO1;2P,
> kf14=\EO1;2Q,
> kf15=\EO1;2R,
> kf16=\EO1;2S,
> use=xterm-debian,
> ^D
> $ tic myxterm.ti
> $ mc
>
> And then I figured that now Shift+F2 acts like Shift+F4. Either Midnight
> Commander expects kf14 to be Shift+F4 (which doesn't seem to be correct,
> I'll show later why), or something is fishy here. Now I made it like
> this:

Some packagers prefer to number shifted-f1 to shifted-f12 as F10-F22.
Some terminals implement this, some implement F13-F24 (hardcoded).

xterm has a resource-setting to select it -

        ctrlFKeys (class CtrlFKeys)
                In VT220 keyboard mode (see sunKeyboard resource),
                specifies the amount by which to shift F1-F12
                given a control modifier (CTRL). This allows you
                to generate key symbols for F10-F20 on a Sun/PC
                keyboard. The default is ``10'', which means that
                CTRL F1 generates the key symbol for F11.

which I added in 2000. The terminfo entries I maintain for ncurses and
xterm reflect the default resource settings. If you want to change the
resource settings, you need a new terminfo entry (suggest doing it with
a script ;-).

> $ cat >myxterm.ti
> xterm|X11 terminal emulator with correct kf-sequences,
> kf11=\EO1;2P,
> kf12=\EO1;2Q,
> kf13=\EO1;2R,
> kf14=\EO1;2S,
> use=xterm-debian,

by the way, Debian maintains "xterm-debian" - it won't be in ncurses
upstream, nor in xterm upstream.

> ^D
> $ tic myxterm.ti
> $ mc
>
> Now it works in mc, but it seems extremely, EXTREMELY, wrong to me.
>
> What do I actually see when I run konsole and try pressing Shift+F1..F4?
>
> $ cat
> ^[O2P^[O2Q^[O2R^[O2S
> $ echo $TERM
> xterm
>
> Now, if you look at xterm+pcfkeys in
> ncurses-5.6+20070716/debian/xterm.ti you'll see that ^[O2S (Shift+F4) is
> mapped to kf16, yet when I press Shift+F4 in Midnight in konsole, it
> works correctly! So what's exactly happening? I clearly can't sanely map
> kf11...kf14 to be Shift+F1...F4 just for midnight (I assume something
> else will likely break then). How do I make Shift+F1...F4 work like they
> work in konsole?

It sounds as if you want to change xterm's modifyFunctionKeys resource.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net