Re: Prompt overwrites command output if prompt contains unicode character and non-printing escape sequence
Lennart Ackermans via Bug reports for the GNU Bourne Again SHell <[email protected]> Mon, 18 May 2026 18:24:01 +0200
| Newsgroups | gmane.comp.shells.bash.bugs |
|---|---|
| Message-ID | <[email protected]> |
Dear Chet, Do you mean that commands should output a newline at the end? I don't have control over what all commands do that I run, and sometimes they don't end with a newline. It would be nice if I could still read their last lines, like in bash 5.2. In bash 5.3 it also works fine for prompts without unicode characters, for example: bash-5.3$ echo -n test testbash-5.3$ On bash 5.2 this also works fine: bash-5.2$ PS1='€ \[\e[0m\]' € echo -n test test€ Best, Lennart On 5/18/26 6:07 PM, Chet Ramey wrote: > On 5/16/26 3:28 PM, Lennart Ackermans via Bug reports for the GNU > Bourne Again SHell wrote: > >> Bash Version: 5.3 >> Patch Level: 9 >> Release Status: release >> >> Description: >> If $PS1 contains a unicode character followed by an escape >> sequence, the prompt appears to be output twice if a command ends >> without a newline: once (correctly) after the output and once at the >> beginning of the line, overwriting the output. The cursor is placed >> after the first, overwriting prompt (on "s" in the example below). >> >> This bug was not present in Bash 5.2. >> >> Repeat-By: >> bash-5.3$ PS1='€ \[\e[0m\]' >> € echo -n test >> € st€ > > If the cursor isn't at position 0 when readline starts, results will be > unpredictable. Readline has to know where it is on the screen so it can > make decisions about which escape sequences to use to move the cursor. > This isn't necessarily the result of having any particular characters in > the prompt string, though having a sequence of non-printing characters > means that readline really does need to know where it is on the screen. > > A simple newline will fix this. >