Alt key not recognized as Meta in xterm

Andy Koppe
Fri Jan 1 16:55:00 GMT 2010

2009/12/30 Gary Carvell:

X issues including xterm ones should go to the cygwin-xfree list. I'm
sending this to both lists, but please respond on cygwin-xfree only.

> With the upgrade to Cygwin 1.7, I found that the Alt key is no longer
> recognized as a Meta key in xterm. This means the Alt based command
> line editing keys such as Alt-F/B for forward- and backward-word must
> be entered with the Esc key instead. I assume this is related to the
> internationalization changes in 1.7.
> I liked the old behavior better, but had some trouble changing it
> back. So here's my little hack for this in case anyone else finds it
> useful. In your home directory, create a file .Xdefaults containing
> this line:
>    XTerm*vt100.metaSendsEscape: true

Actually that's not a hack, but the correct solution. I think this
needs to be part of the default config in /etc/X11/app-defaults/XTerm.

When that option is not enabled, 'meta' is sent by setting the highest
bit of the metafied character, e.g. 'f' (0x66) turns into 0xE6. That's
fine if you're using ASCII only, but obviously it'll conflict with any
character encodings beyond ASCII, ISO-8859-1 and others, 0xE6
is æ (the ae ligature).

And in UTF-8, which of course is the Cygwin default now, a 0xE6 byte
would be an incomplete sequence. That's why xterm applies the meta bit
before doing the UTF-8 encoding, so Alt-f is sent as \xC3\xA6, which
is the UTF-8 encoding for U+00E6 (again: æ) . But bash doesn't
recognise that as Alt-f.

> I'd be glad to hear any background information on the key mapping
> change, or better ways to restore the old behavior.

If you don't need anything beyond ASCII, you could go back to a
singlebyte charset, e.g. by setting 'LANG=en_US.ISO-8859-1'.
Otherwise, the escape prefix is the way to go.


Unsubscribe info:
Problem reports:

More information about the Cygwin-xfree mailing list