Re: [dev] [st] Shift+F1 should by F11?

From: Roberto E. Vargas Caballero <>
Date: Thu, 10 Jan 2013 11:57:31 +0100

On Wed, Jan 09, 2013 at 10:59:59AM +0000, Mihail Zenkov wrote:
> I have problem in mc with Shift+Fx. In st Shift+F6 generate code for
> F18 but mc wait F16 for it.
> >From
> >Shift-F1 through Shift-F10 function as F11 through F20 and generate escape codes from ^[[23~ to ^[[34~, just like the VT220. Note that this means there are two ways to get F11 and F12. (Actually, there are three, since Shift-F11 and Shift-F12 are also equivalent to F11 and F12.)
> I also check in pure console (without X): Shift+F1 = F11, Shift+F2 = F12

The case of the function keys is a problem in all the terminal
emulators. Original vt100 hasn't any function key, and vt102 has 12 function
keys, but the first 4 (PF1-4) were local function keys, they never generate
a code that a program could test, only generate code you could program for
them. These is the reason xterm generates F1-4:


the default value for PF1-PF4 in a vt102, while for F5-12 it generates the
value for F5-12 in a vt220:


From this point, we have a problem because in terminfo definition you can
not specify what values generate the terminal for shifted and "controled"
versions of these keys. So any program that test such combinations are not
portable by definition.

I have tested xterm and it generates:

        Shift-F1 = ^[[1;2P
        F11 = ^[[23~

and st generates:

        Shift-F1 = ^[[1;2P
        F11 = ^[[23~

and the terminfo entry for xterm:


and st terminfor entry:


So they generates the same sequences in the case of Shift-F1, the value for
kf13 and not the value for kf11 like you are reporting. Reading the link you

        Shift-F1 through Shift-F12 were used for F13 through F24, and
        generated codes from ^[[11;2~ to ^[[24;2~. Similarly Ctrl-F1 through
        Ctrl-F12 were used for F25 through F36 and generated codes ^[[11;5~
        to ^[[24;5~, and Ctrl-Shift-F1 through Ctrl-Shift-F12 were used for
        F37 through F48 and generated codes ^[[11;6~ to ^[[24;6

In this moment he is talking about the old key generating of xterm, but a
bit later you can find that he says:

        Since the original VT220 didn't have F1 through F5, the XFree86 xterm uses
        the escape sequences from the VT100's PF1 through PF4 for F1 through F4
        while retaining the VT220-based escape sequences from the X Consortium xterm
        for F5 through F12. So the differences from the earlier xterms are: F1
        through F4 generate escape codes ^[OP through ^[OS, F13 to F16 generate
        ^[O2P to ^[O2S, F25 to F28 generate ^[O5P to ^[O5S, and F37 to F40 generate
        ^[O6P to ^[O6S

But I have tested it in my version of xterm and it works in a different
way. In both cases (new and old function keys) it generates for F11 and
Shift-F1 the sequences I wrote before (I haven't a F13 key so I can not test

I have also tested in the virtual terminal of the kenel (you called it 'pure
console') and I get the values you said:

          Shift-F1 = ^[[25~
          F11 = ^[[23~

I can see that the terminfo entry linux virtual terminal is:


so in this case Shift-F1 also generates F13, but with a different value. In
both cases it should work if the binding is made to F13, but if you bind
something to Shift-F1 it will work or not.
Received on Thu Jan 10 2013 - 11:57:31 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 10 2013 - 12:00:06 CET