[Top][All Lists]

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

Bug with long color prompt + long command line?

From: slinkp
Subject: Bug with long color prompt + long command line?
Date: Mon, 19 May 2008 12:50:40 -0700 (PDT)
User-agent: G2/1.0

I know the presence of "color" in my subject will cause people to tell
me to read
the FAQ section E3; so I already have ;-)

Here's how I can reproduce:

1) set PS1 to use colors and reset the color at the end, as per the
   prompt HOWTO; eg. the "lightweight" prompt described here,

   For example, here's my preferred prompt:
   PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \W \$\[\033[00m\] "
   As far as I can tell, everything is escaped properly... no?

2) cd to a directory with a name that is longer than $COLUMNS
   e.g. if COLUMNS == 80, something like this:
mkdir \

cd \

3) type a command line longer than $COLUMNS; just enter random
   until it wraps. But don't hit enter, instead hit Ctrl-a (or Esc-0
if you prefer vi)

Expected:  The cursor moves to the beginning of the command line.

Observed behavior:  The cursor is displayed several characters after
the beginning of the line, but edits behave as if you ARE at the
beginning of the line, so what you see is not what you get, and
editing the command line becomes almost impossible.

I can reproduce this at the console or in any terminal I've tried
(xterm, rxvt, gnome-terminal, ...)

I checked with several coworkers and they can reproduce this too.

Note that I don't get this problem if I leave out the color reset at
the end of the prompt; eg this works fine:
PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \W \$ "


- don't use a color prompt

- or, don't display \W or \w in the prompt

Can anybody confirm if this is a real bug?

Oh yeah:

$ bash --version
GNU bash, version 3.2.33(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.


- Paul Winkler

reply via email to

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