Bug 143945 - Color prompt causes bad line wraps
Summary: Color prompt causes bad line wraps
Alias: None
Product: Fedora
Classification: Fedora
Component: bash   
(Show other bugs)
Version: rawhide
Hardware: All Linux
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Ben Levenson
URL: www.mephisto.ma.cx/mephisto/bash-bug.png
Depends On:
TreeView+ depends on / blocked
Reported: 2005-01-02 11:40 UTC by Mephisto
Modified: 2007-11-30 22:10 UTC (History)
0 users

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

Attachments (Terms of Use)

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):

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 12:24:04 UTC
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.