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

Re: Alt-Shift-P freezes XTerm



On Sat, Oct 14, 2023 at 07:07:57AM +0200, tomas@tuxteam.de wrote:
> On Fri, Oct 13, 2023 at 01:06:20PM -0700, Van Snyder wrote:
> > I haven't figured out how to unlock the XTerm after accidentally giving
> > it Alt-Shift-P.

I'm not seeing whatever it is you're seeing here.  On Debian 12, if I
launch an xterm (simply "xterm &") with bash running inside it, and
press Alt-P I get this character: ð

Shift-Alt-P gives me this character: Ð

This is independent of whether bash is in emacs mode or vi mode.

> > But I did work out how to prevent it. Put
> > xterm*altIsNotMeta: truexterm*altSendsEscape: true
> > in your .Xdefaults (or .Xresources, or link those files together), then
> > xrdb -merge ~/.Xdefaults
> 
> Interesting. If I do that I see a colon, which disappears if I
> hit enter afterwards. Then things are "back to normal".
> 
> If I run "od -C" on that term, I see the sequence "1b P", so I
> guess the term is just passing "ESC P" to the shell, and the one
> doing the magic is actually the shell running in there.
> 
> The behaviour is the same if I do "ESC P". Does that "hang your
> Xterm", too?

Looks like your bash is in emacs (default) mode.  Pressing Esc P in
emacs mode triggers this guy:

"\eP": do-lowercase-version

whose description in readline(3readline) says

    do-lowercase-version (M-A, M-B, M-x, ...)
        If the metafied character x is uppercase, run the  command  that
        is bound to the corresponding metafied lowercase character.  The
        behavior is undefined if x is already lowercase.

So... apparently it's supposed to act the same as "metafied lowercase p",
which I guess means it's running this guy:

"\ep": non-incremental-reverse-search-history

    non-incremental-reverse-search-history (M-p)
        Search backward through the history starting at the current line
        using  a  non-incremental  search  for  a string supplied by the
        user.

I'm not 100% sure what that means, but maybe you can figure it out if
you continue experimenting with it.  I don't normally run bash in emacs
mode myself, so many of these readline features are foreign to me.

Anyway, all of that's an interesting tangent, but I still don't get
a "freeze" in xterm from any of this.

Van Snyder, can you try running this in your xterm:

    bind -p | grep P

That should tell us whether you have any unusual readline bindings
involving the letter P (capital) which might be at fault here.  In my
shell, I just have these:

unicorn:~$ set -o vi
unicorn:~$ bind -p | grep P
"P": self-insert
unicorn:~$ set -o emacs
unicorn:~$ bind -p | grep P
"\C-xP": do-lowercase-version
"\eP": do-lowercase-version
"P": self-insert

If yours is different, then we have something to investigate.


Reply to: