[Top][All Lists]

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

Bash 3.0 / Readline 5.0: broken prompt handling

From: Ralf S. Engelschall
Subject: Bash 3.0 / Readline 5.0: broken prompt handling
Date: Wed, 28 Jul 2004 10:20:38 +0200
User-agent: Mutt/

After upgrading the OpenPKG "bash" package to 3.0, we had to discover
that the prompt handling on Bash 3.0 / Readline 5.0 is broken if a
multiline prompt (a string containing newlines) is used. The effect is
that on the first input line (where the last line of the prompt is the
prefix) the input line is wrapped N characters before the last column
where N seems to be exactly the length (including newlines) of the
prompt ($PS1) minus the characters on the last line of the prompt.


|$ echo $COLUMNS                                                                
|$ PS1="aaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbb\nccccc"                                

Here I pressed "d" just long enough in sequence so the line wrapped. It
is interesting that that the number of whitespaces after the wrapped
line is 29 which is more or less the length of the prompt minus its last
display line. I tried many examples and the wrapping gap seems to be
always directly related to those characters in $PS1. With Bash 2.05b.007
this does not happen. There the line is not wrapped before the last
column on the screen.

Finally, during testing I've found another subtle bug. Although the
multiline prompt bug is horrible (because I actually use such a prompt
all the time), fortunately this one is just a theoretical one because I
cannot imagine why anybody would want to use such a prompt. If you set
PS1="foo\r\bar\rbaz" the displayed prompt is the expected "baz" only.
But if you fill the line to the last column, the line is not continued
on the next screen line but instead the prompt is overwritten.

                                       Ralf S. Engelschall

reply via email to

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