From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: random attribute stuff
Date: Wed, 07 May 2008 17:49:21 +0200 [thread overview]
Message-ID: <30463.1210175361@thecus> (raw)
In-Reply-To: <20080506191611.79fdf69a@news01>
This is definitely useful. Leaving attributes on at then end of the
prompt is something I always used to do. It still works except that it
all gets messed up by menu completion. I'm not sure about coloured
completion listings because I don't use them. In any case, it was enough
that I stopped leaving attributes on after the prompt.
I've attached a patch which changes prompt_oliver_setup to use
zle_highlight. This fixes things for the interaction with
region_highlight from my bracket matching widget but is still broken
when I use menu completion. It is especially broken if the bold
attribute is set: I get >= symbols around the matches.
Given that zsh now has internal knowledge that "green" is ESC [32m and
so on, would it be wise to allow this in prompt escapes: %A{fg=green}
perhaps? Or maybe support a prompt element in zle_highlight. I've only
ever used single colour prompts. Support for more than 16 colours would
also be good. SGI's terminal supported them 15 years ago.
Oliver
Index: prompt_oliver_setup
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_oliver_setup,v
retrieving revision 1.3
diff -u -r1.3 prompt_oliver_setup
--- prompt_oliver_setup 31 Jan 2002 15:30:42 -0000 1.3
+++ prompt_oliver_setup 7 May 2008 15:24:23 -0000
@@ -23,21 +23,22 @@
[[ "${(t)pcolour}" != assoc* ]] && typeset -Ag pcolour
[[ "${(t)tcolour}" != assoc* ]] && typeset -Ag tcolour
- local pcol=${1:-${pcolour[${HOST:=`hostname`}]:-yellow}}
+ local pcol=${1:-${pcolour[${HOST:=`hostname`}]:-bold}}
local pcolr=$fg[${pcol#bold}]
- [[ $pcol = bold* ]] && pcolr=$bold_color$pcolr
+ [[ $pcol = bold* ]] && pcolr=%B$pcolr
- local tcol=${2:-${tcolour[$HOST]:-white}}
- local tcolr=$reset_color$fg[${tcol#bold}]
- [[ $tcol = bold* ]] && tcolr=$tcolr$bold_color
+ local tcol=${2:-${tcolour[$HOST]}}
+ local tcolr="fg=${tcol#bold}"
+ [[ $tcol = bold* ]] && tcolr=bold,$tcolr
local a host="%m:" user="%n "
[[ $HOST == (${(j(|))~normal_hosts}) ]] && host=""
- [[ ${USER:-`whoami`} == (root|${(j(|))~normal_users}) ]] && user=""
+ [[ $LOGNAME == (root|${(j(|))~normal_users}) ]] && user=""
- PS1="%{$pcolr%}$user$host%~%"'$((COLUMNS-12))'"(l.$prompt_newline.
)[%h%1(j.%%%j.)%0(?..:%?)]%# %{$tcolr%}"
+ PS1="%{$pcolr%}$user$host%~%"'$((COLUMNS-12))'"(l.$prompt_newline.
)[%h%1(j.%%%j.)%0(?..:%?)]%# %{$reset_color%}"
RPS2='<%^'
PS2=''
+ zle_highlight[(r)default:*]=default:$tcolr
}
prompt_oliver_setup "$@"
next prev parent reply other threads:[~2008-05-07 15:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-06 9:15 Peter Stephenson
2008-05-06 14:34 ` Bart Schaefer
2008-05-06 14:42 ` Peter Stephenson
2008-05-06 14:58 ` Bart Schaefer
2008-05-06 15:10 ` Peter Stephenson
2008-05-06 15:38 ` Bart Schaefer
2008-05-06 15:48 ` Peter Stephenson
2008-05-06 18:16 ` Peter Stephenson
2008-05-07 15:44 ` Oliver Kiddle
2008-05-07 15:49 ` Oliver Kiddle [this message]
2008-05-07 15:55 ` Peter Stephenson
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=30463.1210175361@thecus \
--to=okiddle@yahoo.co.uk \
--cc=zsh-workers@sunsite.dk \
/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).