From: Zefram <zefram@dcs.warwick.ac.uk>
To: willday@rom.oit.gatech.edu
Cc: zsh-users@math.gatech.edu
Subject: Re: problem with bold prompt
Date: Fri, 31 Jan 1997 00:08:35 +0000 (GMT) [thread overview]
Message-ID: <5161.199701310008@stone.dcs.warwick.ac.uk> (raw)
In-Reply-To: <199701302313.SAA12620@rom.oit.gatech.edu> 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
next prev parent reply other threads:[~1997-01-31 0:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-01-30 23:13 Will Day
1997-01-31 0:08 ` Zefram [this message]
1997-01-31 0:14 ` Aaron Schrab
1997-01-31 4:23 ` Vidiot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5161.199701310008@stone.dcs.warwick.ac.uk \
--to=zefram@dcs.warwick.ac.uk \
--cc=willday@rom.oit.gatech.edu \
--cc=zsh-users@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).