[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: curses vs. xterm key mismatch

From: Thomas Dickey
Subject: Re: curses vs. xterm key mismatch
Date: Wed, 18 Apr 2007 20:35:08 -0400 (EDT)

On Tue, 17 Apr 2007, Will Parsons wrote:

Thomas Dickey wrote:
On Mon, 16 Apr 2007, Will Parsons wrote:

"switch the terminal description" - is this something specific to FreeBSD
that I would have to ask on a FreeBSD newsgroup?

no, I just meant to either use a different setting for $TERM (simple),
or to use a new termcap/terminfo (complex).

I've been playing with different values for TERM without success...
According to a comment in the termcap file, it *sounds* like the correct
setting might be to set TERM to xterm-xfree86 and set the resource
XTerm*sunKeyboard to true, but although this changes the behaviour of the
End key, it does give me the correct mapping.  Perhaps I need to create a
modified a xterm entry that does what I want?

Well you can also set resources to match the termcap.  But the simpler
solution would be to update the termcap.

A quick check shows I'm using the PC-style in xterm's terminfo.
Ditto for ncurses.  FreeBSD has its own termcap (though I recall
its xterm entries being modified to match ncurses a couple of years
ago).  But it could be either flavor - or both.  At one point both
definitions were in the terminal description, but since curses uses
only one, I removed the one that was less useful.  If your terminal
description has both, curses will use the first one in the table,
(looks like KEY_HOME would override...)

I'm still unsure of what I should be doing - complaining to FreeBSD that
something is wrong with their termcap/terminfo, making some sort of
adjustment in my environment, or simply accepting that KEY_SELECT may do
the same as KEY_END and allowing for that in my application?

Perhaps both.

At the moment I'm looking at the FreeBSD termcap, which appears to be
using for "xterm" the entries that I had updated for XFree86 in 2001.
That was imported into FreeBSD in 2002/08/27.

That particular file is hand-maintained, though I generate a termcap.src
from ncurses' terminfo.src periodically.  Checking now, I see that xterm's
termcap file still uses Select as well as End (does not cancel one in
favor of the other, but just adds them both).  But the intent of that file
is not to support curses applications, just low-level termcap applications
(though that's what FreeBSD used it for ;-).

For terminfo, I canceled the conflicting keys from the descriptions
a while back (and those are PC-style, with a comment in the terminfo
file indicating how to change the entries to vt220-style).

So - using the termcap entry for curses means you'll get one set of
keycodes, but using the terminfo entry means you'll get a different set.

But this is nothing I can choose, is it?  (Short of rebuilding ncurses,
which I don't think I want to do.)  My understanding is that applications
are built to use one or the other, with newer applications using terminfo
instead of termcap.

Actually on FreeBSD, they prefer using termcap.  Except for the recent
updates for ncurses 5.6, it's storing the termcap information in a hashed database, using ncurses' termcap support to read it. You can always modify that termcap database. With ncurses 5.6 update, you can store terminfo in a similar hashed database (in contrast to the filesystem terminfo used in most cases)....

Thomas E. Dickey

reply via email to

[Prev in Thread] Current Thread [Next in Thread]