bug-bash
[Top][All Lists]
Advanced

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

Re: Should the readline *-meta flags reset when $LANG changes?


From: Koichi Murase
Subject: Re: Should the readline *-meta flags reset when $LANG changes?
Date: Tue, 15 Nov 2022 01:40:10 +0900

2022年11月15日(火) 0:22 Chet Ramey <chet.ramey@case.edu>:
> On 8/11/22 5:56 PM, Koichi Murase wrote:
> > Can we also change the behavior of TERM in a similar way with option
> > 4?  Currently, a temporal change of TERM clears keybindings of some
> > keys (home, end, right, left, etc.) even when the temporal change does
> > not survive across multiple calls of readline:
>
> I finally got back to look at this, and I couldn't reproduce it. That was
> expected, since the arrow key binding functions are pretty careful not to
> overwrite an existing binding. Then I figured out what was going on.

Thank you for checking this.

> >
> > $ bash-dev --norc
> > $ echo "$TERM"
> > screen.xterm-256color
> > $ bind '"\e[1~": bell'
>
> This unbinds the key sequence, since `bell' is not a valid bindable command
> name.

Ah, OK. The above ``reduced case'' was not correct, but unbinding is
actually what I wanted to do in the original problem. In the original
code, I intentionally unbind the keybinding for "\e[1~" and instead
try to bind a single byte `\e'. However, after running "TERM=xxx
infocmp" in the command line, the keybinding does not work anymore
This is what I experienced. Currently. as a workaround, I run the
unbinding and rebinding code [1] every time the user command is
executed, but I would like to skip the workaround if possible in newer
versions of Bash.

[1] The related code is found at
https://github.com/akinomyoga/ble.sh/blob/0c6291f0c1/src/edit.sh#L6410-L6438

> I think the "TERM=$TERM" idiom to reset the readline terminal settings
> without overwriting existing key bindings is useful enough to retain the
> current behavior.

I think it can be useful, but should that also apply to the tempenv of
the form "TERM=$TERM infocmp"? In the sense that the side effects of
the temporary environment variables (tempenvs) are intended to be not
persistent after the execution of the command (unless it is for
special builtin and functions in the POSIX mode), I would like to
request that the idiom TERM=$TERM to reset the terminal settings would
not be invoked for the tempenvs.

--
Koichi



reply via email to

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