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

Re: colors in text-mode



On Wed, 28 Oct 1998, Lee Bradshaw wrote:

> On Thu, Oct 29, 1998 at 12:53:03AM +0100, Carsten Wimmer wrote:
> > Hi!
> > 
> > >> I was wondering....how might I get the login prompt to use some colors? 
> > > in your home-dir modify .bashrc, try e.g.:
> > 
> > I tried this and the colors themselves work fine.
> > 
> > But if I type something on the keyboard and hit column ~70, all the
> > next characters are placed on the same row and column 1. No real line
> > bread is done, also the columns 70-80 are completely unused.
> > I am using rxvt v2.4.5 and GNU bash 2.01.1(1).
> > 
> > Without the \e['s it works as expected (real line bread at
> > col 80).  Any ideas?
> 
> You need to tell the shell to only count certain characters so it knows the
> correct width. See the example below. If you're changing colors several times,
> you will need \[ \] pairs around each set of color control chars.
> 
> # Set up shell variables:
> case "$TERM" in
>    xterm* )  PS1='\h \w \$ \[\033]0;\h \w\007\]' ;;  # set xterm title/icon
>    #                       \[                \] surround non-printing chars
>    * )       PS1='\h \w \$ ' ;;
> esac
> 
> -- 
> Lee Bradshaw                 lee@sectionIV.com (preferred)
> Alantro Communications       lee@alantro.com
> 
> 

I was having this same problem; good fix. Thanks!



Reply to: