[illumos-Developer] Terminfo handling of pg/home/etc keys
Guido Berhoerster
guido+illumos.org at berhoerster.name
Wed Oct 20 03:37:43 PDT 2010
* Joerg Schilling <Joerg.Schilling at fokus.fraunhofer.de> [2010-10-20 10:47]:
> Guido Berhoerster <guido+illumos.org at berhoerster.name> wrote:
>
> > > > > You'll only find "Pos1" on German keyboards, it's "Home" on my
> > > > > 101 US PC keykboard.
> > > > > They also generate \E[H and \E[F in my xterm, verified via
> > > > > ksh93 -c 'set -o gmacs;function sc { printf "|%q|\n" "${.sh.edchar}";.sh.edchar=;};trap sc KEYBD;read -r c'
> > > > >
> > > >
> > > > On my keyboard, output of this command after pressing Home and End keys
> > > > is \EOF and \EOH
> > >
> > > I cannot speak for ksh93 and I don't know what this program does.....
> > >
> > > It seems however that ksh93 uses the terminal emulator in a different mode than
> > > vi. Which mode the tty operates in depends on the init string that is part of
> > > the temcap or terminfo descriptor. The tests however show that the keys
> > > labelled "Home" and "End" by xev produce \EOH and \EOF in vi.
> >
> > That entirely depends wheter is uses the application cursor mode
> > or not, in xterm you control it with the appcursorDefault X
> > resource, you can also switch modes in the VT Options menu (by
> > default opened through ctrl+middle click) where it is called
> > "Enable Application Cursor Keys". Depending on whether it is
> > enabled or not xterm either produces ANSI or application cursor
> > mode escape sequences for all cursor keys. That is documented
> > behavior of xterm, please see my earlier mail for a link to the
> > corresponding xterm control sequences documentation.
>
> a) You may use a non-standard default for your xterm
>
> b) Even if you change the default state in a different way, if
> it has a conforming ANSI terminal emulation, then the second
> call to an editor will get the official behavior.
On a stock OpenIndiana install application cursor mode (DECCKM)
is off by default, hence it produces \E[-like escape sequences
not only for home and end but all other cursor keys.
> All I can say for now is that the vi (using the TERMINFO entry from Sun)
> will see \EOH and \EOF
Yes, that is because applications can switch between normal and
application cursor mode with \E[?1h and \E[?1l (and vi and others
likely do that).
Please read section "PC-Style Function Keys" on
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html where all
of this is explained in detail.
> In addition, I can say that my editor (ved) that is TERMCAP based will also
> see \EOH and \EOF even in case you use it together with the TERMINFO->TERMCAP
> converted xterm entry from Anil.
Anil's patch is fine.
--
Guido Berhoerster
More information about the Developer
mailing list