Re: Prompt overwrites command output if prompt contains unicode character and non-printing escape sequence
Chet Ramey <[email protected]> Mon, 18 May 2026 12:07:56 -0400
| Newsgroups | gmane.comp.shells.bash.bugs |
|---|---|
| Organization | ITS, Case Western Reserve University |
| Message-ID | <[email protected]> |
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. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
(application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE----- wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCags5XAUDAAAAAAAKCRC7WGnwZOp0q/rt AJ93vnyC2nvUrEozBiZmGzzHhzXWuwCgkczGkgXv9V/DVpDXp5FjeV7AaNc= =EHTu -----END PGP SIGNATURE-----