Red Hat Bugzilla – Bug 143945
Color prompt causes bad line wraps
Last modified: 2007-11-30 17:10:57 EST
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):
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.
You need to use \[ and \] around the non-printing characters -- see the man page.