bug-bash
[Top][All Lists]
Advanced

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

when last output lacks \n, bash gets confused about cursor position


From: Benno Schulenberg
Subject: when last output lacks \n, bash gets confused about cursor position
Date: Tue, 12 Aug 2008 20:02:52 +0200
User-agent: KMail/1.9.9

Hi,

When using 'echo -n' or printf without a final \n, and then using 
the Up and Down keys to walk through previous commands, bash can 
get confused about its cursor position (or rather its prompt 
position) and either leave some stray text in the middle of the 
line, or overwrite part of its prompt.

An example of the stray text is given in the attached typescript.  
It was produced with this command:

  script -t -c 'env -i bash --norc --noprofile' 2>timing

and then typing: <space>echo -n "some text"<enter>, <space>, 
<arrowup>, <arrowdown>, <arrowup>, <arrowdown>, <enter>, <space>, 
exit<enter>  --  without the comma+space pairs of course.  (The 
<space>s are not relevant but are to defeat a bug in the timing.)

The first <arrowdown> causes bash to rewrite its prompt at the start 
of the line (instead of after "some text") and not outputting enough 
spaces to clear the entire line.

Benno

Attachment: typescript
Description: Text document

Attachment: timing
Description: Text document


reply via email to

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