Bug 143945 - Color prompt causes bad line wraps
Color prompt causes bad line wraps
Product: Fedora
Classification: Fedora
Component: bash (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2005-01-02 06:40 EST by Mephisto
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-01-02 07:24:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mephisto 2005-01-02 06:40:46 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):

How reproducible:

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 07:24:04 EST
You need to use \[ and \] around the non-printing characters -- see the man page.

Note You need to log in before you can comment on or make changes to this bug.