Bug 143945

Summary: Color prompt causes bad line wraps
Product: [Fedora] Fedora Reporter: Mephisto <mephisto>
Component: bashAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: www.mephisto.ma.cx/mephisto/bash-bug.png
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-01-02 12:24:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mephisto 2005-01-02 11:40:46 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041228 Firefox/1.0 Fedora/1.0-8

Description of problem:
i recently set my command prompt to include colors, and i started
noticing weird behavior after that. when i type text that exceeds a
certain number of characters, the text starts over from the same line
as where i was typing, instead of going to the next line, and it wraps
way too early. i have included a link to a screenshot to make the
problem more clear.
i have set my prompt with the following line in .bashrc:
[code]export PS1='[\033[32;1m\u\033[0m@\033[34;1m\h\033[0m \W]\$ '[/code]
changing colors doesnt help, and the problem goes away immediately
after removing the colors.

Version-Release number of selected component (if applicable):
bash-3.0-25

How reproducible:
Always

Steps to Reproduce:
1. open a shell
2. type "export PS1='[\033[32;1m\u\033[0m@\033[34;1m\h\033[0m \W]\$ '"
3. type text until the cursor wraps to the beginning of the line.
    

Actual Results:  see screenshot

Expected Results:  the text should continue until the end of the line,
and move to the next line when it reaches that point.

Additional info:

Comment 1 Tim Waugh 2005-01-02 12:24:04 UTC
You need to use \[ and \] around the non-printing characters -- see the man page.