bug-bash
[Top][All Lists]
Advanced

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

Re: Incorrect positioning when long prompt contains ANSI escape sequence


From: Martin D Kealey
Subject: Re: Incorrect positioning when long prompt contains ANSI escape sequences + UTF-8 LANG
Date: Fri, 9 Aug 2024 18:18:28 +1000

HI Gioele

Typically problems with the prompt are because the \[ and \] are misplaced
or completely missing, but in this case the bug report indicates that they
have indeed been used correctly; so thankyou for checking that first.

The fact that characters are all printed in the same place (over each
other) leads me to suspect mis-handling of auto-margins, which is also
known to cause problems with the prompt.

Does this problem occur with other versions of Bash?
With other versions of libreadline.so?
With other terminal emulators?

Please let us know which ones you've tested, and which of them do or don't
exhibit the problem.

If the problem persists with all permutations, please also:

1. report the output from these commands:

echo term=$TERM
e=( enabled disabled )
tput am ; echo right-auto-margin=${e[$?]:-$?}
tput bw ; echo left-auto-margin=${e[$?]:-$?}
tput sam ; echo semi-auto-margin=${e[$?]:-$?}

2. report the active auto-margin setting in your terminal emulator, at the
point where you observe the issue (and before entering or erasing anything)

If using Xterm, use the ctrl-middle-button menu and note whether the
"Enable Auto Wraparound" and "Enable Reverse Wraparound" settings are
enabled. If using some other terminal emulator, consult its documentation
for the corresponding settings.

-Martin

On Fri, 9 Aug 2024 at 05:40, Gioele Barabucci <gioele@svario.it> wrote:

> Hi,
>
> bash 5.2.21 produces severely wrong artifacts under the following
> conditions:
>
> * the length of the prompt matches $COLUMN*2 + 1;
> * the prompt contains ANSI escape sequences;
> * the LANG variable is set to an installed UTF-8 locale.
>
> When all these conditions are met, pressing the up arrow/down arrow will
> place the cursor in the wrong spot. After that, all typed character will
> be shown in the same place, overwriting each other.
>
> To reproduce:
>
>      $ set LANG=C.UTF-8
>      $ PS1=$(eval "printf x%.0s {1..$((COLUMNS*2-1))}")$'\[\e[0m\]\$ '
>      (press up arrow)
>      (type anything; text ends up in the wrong place)
>      $ unset LANG
>      (press up arrow)
>      (type anything; text is displayed correctly)
>
> Extracted from https://bugs.debian.org/1018851
>
> Regards,
>
> --
> Gioele Barabucci
>
>


reply via email to

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