[Top][All Lists]

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

Text wraps with \w at wrong position if colors used

From: alexander
Subject: Text wraps with \w at wrong position if colors used
Date: Sun, 1 Aug 2004 14:47:21 +0200 (CEST)

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib   -O3 -fomit-frame-pointer 
-march=athlon-xp -pipe
uname output: Linux server 2.6.7-ck5 #3 Mon Jul 26 23:12:12 CEST 2004 i686 AMD 
Athlon(tm) XP 2000+ AuthenticAMD GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 3.0
Patch Level: 0
Release Status: release

Gentoo Linux ships a /etc/profile which sets the PS1 like this:
        export PS1='\[\033[01;address@hidden \[\033[01;34m\]\W \$ \[\033[00m\]'
This adds some coloring to the prompt. With a PS1 containing ANSI escapes
like the ones shown above, the prompt wraps in \W (or \w) at the wrong

As a user, do:
shopt -s checkwinsize

If I do that, I see this output:
9g123456789h123456789i123456789j123456789k123456789l $

Here, the text is wrapped AFTER the "45678" and before the "9g". "45678" 
is already on the 2nd line of output.

What should happen, is that there should be NO wrap after the 45678 and 
that the 9g is on the 2nd line of output.

Two "solutions":
a) Remove the ANSI escapes from the PS1
b) Downgrade to bash 2.05; IOW: in bash 2.05, the problem did not exist.

reply via email to

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