This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

odd bash wrapping due to ansi codes

environment is a clean install of 1.1.4 from the "latest"
as of 7 Sept, window is set to 132 columns wide, $COLUMNS is
also set to 132. PS1 is set to:
'<0x1b>]0;\w<0x07><0x1b>[1m<0x1b>[34m\w<0x1b>[0m $ '

cd /tmp
mkdir -p 

{wrapping bug #1: mkdir command is wrapped between x and t of sixteen,
at column 110}

cd one/
cd two/
cd ...

repeating this by means of: "up arrow, esc, backspace, tab, enter"

after cd ten you'll see wrapping bug #1b,
   command is wrapped at column 61

after cd eleven you'll see wrapping bug #2,
   prompt is wrapped at column 58

each cd after that you'll see the prompt is
   wrapped *earlier* than before

until after cd eighteen, when it tries to wrap at
   a negative column and the result is some binary
   looking junk in the prompt. This is also the point
   where the titlebar stops being in sync; it appears
   that from here forward each prompt begins with the
   trailing junk that's been truncated from the titlebar.

if the titlebar manipulations are removed from PS1 then
everything goes well up until cd eighteen and nineteen,
where there are some issue with crlfs being left out, but
once you get past there then the prompt is properly wrapped
and everything is ok.

if all ansi codes are removed (PS1='\w $') then there are
no problems at all.

On a related note:

the default /etc/profile sets up these ansi codes by
default for all terminals, I'd suggest that at the bare
minimum these be skipped if the term type is incapable.

I've set mine up as:

if [ "$TERM" == "cygwin" ]; then
	PS1='' #cygwin version with ansi codes
	PS1='\w $'
export PS1

and as long as I'm in that file, I just saw the other
patch I put in my copy....

if [ "$SHELL" != "/bin/bash" ]; then
	test -f ./.profile && . ./.profile
	test -f ./.bashrc && . ./.bashrc

this has the advantage for those who run bash of not
sourcing these files twice, as bash does so itself.

Want to unsubscribe from this list?
Send a message to

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]