[Top][All Lists]

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

Re: [Bug-readline] Problem with readline or ncurses

From: Chet Ramey
Subject: Re: [Bug-readline] Problem with readline or ncurses
Date: Fri, 13 Apr 2007 16:38:30 -0400
User-agent: Thunderbird (Macintosh/20070221)

Fredrik Tolf wrote:

> I noticed that my xterms suddenly didn't want to send Alt/Meta key
> combinations as Esc+button anymore, but with the 8th bit set, which I've
> always thought sucks (it doesn't exactly work very well when typing
> 8-bit characters).
> At first, I thought the fault was with xterm, but after some debugging,
> it seems that it is readline which always sends the terminfo "mm" string
> whenever the "km" capability is present. The fault started appearing
> since the latest ncurses update contained a new xterm terminfo file
> which has the mm and mo strings (the old one didn't, it seems).

The code to do this has been in readline for many years (maybe 15).  The
original idea was this: `km' says whether or not you have a meta key,
and you have to send `mm' if you ever want to use it.  The meta key can
be anything: alt, option, command, whatever -- readline's goal is to set
up a clean interface between the terminal and OS that can deliver metafied
characters if desired.  These characters can either be ones with the
eighth bit set, or some key sequence with a meta prefix.  The metafied
characters are not required to be, but at this point usually are,
characters with the eighth bit set, and the use of the `mm' capability
has evolved to mean "support some mechanism to send characters with the
eighth bit set."

If you have an 8-bit clean path out of the terminal, you can either use
the terminal driver or readline via the locale or variables to handle
8-bit input.  In readline's case, you may configure it to convert 8-bit
characters into escape- prefixed key sequences.  So at this time, readline
sends `mm' to make sure that it can get 8-bit characters, and uses other
variables to decide how to handle them.

> I also got the feeling that "km" is used more
> generically than that, to rather indicate the presence of a Meta key,
> regardless of whether it sends escape combinations or 8-bit characters,
> and in that case, I would think it is a fault with readline for always
> sending "mm" when "km" is present.

How would readline tell the difference?  Why have the useless `mm'
capability at all, then?  If `km' is used to indicate the presence of a
meta key, and users need to configure its behavior separately, what
function does `mm' serve?  If the answer is that you want a way for
applications to make sure there's an 8-bit path between the terminal
and the terminal driver, then readline's behavior is appropriate.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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