On Thu, Sep 07, 2023 at 04:03:39PM +0200, Gioele Barabucci wrote:
> The following snippet shows that, even with the final \], Bash produces the
> same erroneous output and miscalculates the cursor position (it just needs a
> longer prompt):
> 
>     $ long_name="$(printf 'abcdef0123456789/%.0s' {0..20})"
>     $ mkdir -p /tmp/$long_name
>     $ cd /tmp/$long_name
>     $ PS1=$'\n\[\e[1m\]\w\[\e[m\] \$ '
> 
>     Now press the up arrow, then the down arrow)

I did this in bash 5.2.15 (Debian 12 package version 5.2.15-2+b2) in
rxvt-unicode (Debian 12 package version 9.30-2+b4), and I can't see
whatever problem you're reporting.  Typing a long command (one which
goes past the 80th column and scrolls the terminal's text upward) and
then backspacing all of it acts as expected.  As does pressing up arrow
until a sufficiently long command is recalled from history.

Have you tried testing with several different terminal emulators?  Be
sure to include xterm among them, as that one tends to be extremely
well-behaved in situations where the big fancy ones are not.  I'm a fan
of rxvt or rxvt-unicode, which have both been kind to me, but good old
xterm should always be considered.

Reply via email to