Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: problem with bold prompt
- X-seq: zsh-users 641
- From: Zefram <zefram@xxxxxxxxxxxxxxxxx>
- To: willday@xxxxxxxxxxxxxxxxxx
- Subject: Re: problem with bold prompt
- Date: Fri, 31 Jan 1997 00:08:35 +0000 (GMT)
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <199701302313.SAA12620@xxxxxxxxxxxxxxxxxx> from "Will Day" at Jan 30, 97 06:13:25 pm
Will Day wrote:
>My prompt is defined as:
> export PS1="^[[1m${HOSTNAME}:^[[m%d) "
...
>It looks like zsh is counting the formatting characters as printable
>characters on the command-line.
This is exactly what it is doing; you have done nothing to tell it that
the escape sequences are not printable. You can do that directly by
surrounding them in %{ and %}:
PS1='%{^[[1m%}${HOSTNAME}:%{^[[m%}%d) '
However, this still suffers one of the same basic problems as your
first attempt -- it will only work on a vt100-compatible terminal. You
can solve this by using the sequences %B and %b to mark the bold text:
PS1='%B${HOSTNAME}:%b%d) '
This is more readable. zsh will substitute the correct sequences for
whichever terminal you are using, and knows that they don't take up any
screen space (or, on a few odd terminals, that they do).
-zefram
Messages sorted by:
Reverse Date,
Date,
Thread,
Author