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

Bug#179286: xterm: alt-return has a strange effect



Alessandro Dalvit <a_dalvit@katamail.com> writes

> When typing alt+return the cursor goes up one line (causing other
> text to scroll downwards when it reaches the top of the window).
> The most boring fact is that the terminal keeps an abnormal
> behavior when scrolling in the history with the up key: as soon as
> it tries to show the command line with these codes, the text layout
> gets broken as the cursor writes to already written areas.

This is consistent with the documented behavior of xterm when the
eightBitInput resource is "yes" (which it is by default).

In this state, the meta key makes xterm set the most significant-bit
of the characters you type. In the present case it converts the usual
ASCII CR, 0x0D that Return produces to 0x8D.

If your locale is not C or POSIX, bash will default to 8-bit clean
mode and not recognize 0x8D as a control character but instead try to
echo it to the terminal. When xterm *recieves* an 0x8D it acts on it,
correctly, as the control character RI and performs a "Reverse Index"
operation; i.e. moving the cursor upwards and scrolling backwards if
necessary.

It is arguably a bug (or at least a shortcoming) in bash that it
treats 0x8D as a printing character even in 8-bit-clean mode. The bash
source (bash-2.05b.orig/lib/realine/emacs_keymap.c) says that it is
because "these might be used in some character set", but even so the
Right Thing would be to ask the locale-enabled ctype functions which
characters are printable. Nonprintable characters should be unbound by
default.

However, I *also* think that it is wrong for Debian to ship an xterm
that has eightBitInput set by default. Many of xterm's resources have
counterintuivite names; eightBitInput really means "I'm only ever
going to input 7-bit characters, so xterm is welcome to appropriate the
8th bit for its own purposes". I think the default configuration
should be 8-bit clean - in other words, the default
/etc/X11/app-defaults/XTerm should contain

   *eightBitInput: false

-- 
Henning Makholm                      "The compile-time type checker for this
                           language has proved to be a valuable filter which
                      traps a significant proportion of programming errors."




Reply to: