From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7514 invoked from network); 31 Jan 1997 00:23:36 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 31 Jan 1997 00:23:36 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id TAA28715; Thu, 30 Jan 1997 19:17:21 -0500 (EST) Resent-Date: Thu, 30 Jan 1997 19:07:06 -0500 (EST) From: Zefram Message-Id: <5161.199701310008@stone.dcs.warwick.ac.uk> Subject: Re: problem with bold prompt To: willday@rom.oit.gatech.edu Date: Fri, 31 Jan 1997 00:08:35 +0000 (GMT) Cc: zsh-users@math.gatech.edu In-Reply-To: <199701302313.SAA12620@rom.oit.gatech.edu> from "Will Day" at Jan 30, 97 06:13:25 pm X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]8810.02 X-US-Congress: Moronic fuckers Content-Type: text Resent-Message-ID: <"fZzjN1.0.ku6.gUJyo"@euclid> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/641 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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