zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: 8-bit parameter names?
Date: Mon, 09 May 2005 17:24:50 +0000	[thread overview]
Message-ID: <1050509172451.ZM11220@candle.brasslantern.com> (raw)

Is it intentional that 8-bit characters can be used in parameter name
identifiers, or is it a bug?

I was just looking at prompt_elite2_setup again, which has this comment:

 Recommended fonts for this theme: nexus or vga or similar.  If you
 don't have any of these, the 8-bit characters will probably look stupid.

In fact, the 8-bit characters don't look like anything at all, because
they're never displayed.  They're never displayed because the assingment
to PS1 is full of stuff like "$punctuation_colorU$textA..." where I've
replaced an 8-bit U-with-acute and A-with-umlaut with ascii U and A for
mailing list sanity.

The parameter code is treating e.g. U-with-acute as a valid part of the
identifier and finding no such parameter, so large parts of the elite2
prompt have simply been disappearing.  (If set_prompt didn't execute
"emulate -L zsh" (which turns off the "nounset" option) this would have
been much easier to catch.)

The prompt_elite2_setup function, meanwhile, was apparently meant all
along to be as follows; not sent as a patch because again I'm avoiding
sending 8-bit characters to the mailing list.


prompt_elite2_setup () {
  local text_col=${1:-'cyan'}
  local parens_col=${2:-$text_col}

  for code in 332 304 300; do
    local varname=char_$code
    : ${(P)varname=$(echo -n "\\0$code")}
  done

  local text="%{$fg_no_bold[$text_col]%}"
  local parens="%{$fg_bold[$parens_col]%}"
  local punct="%{$fg_bold[grey]%}"
  local reset="%{$reset_color%}"

  local lpar="$parens($text"
  local rpar="$parens)$text"

  PS1="$punct$char_332$text$char_304$lpar%n$punct@$text%m$rpar$char_304$lpar%!$punct/$text%y$rpar$char_304$lpar%D{%I:%M%P}$punct:$text%D{%m/%d/%y}$rpar$char_304$punct-$reset$prompt_newline$punct$char_300$text$char_304$lpar%#$punct:$text%~$rpar$char_304$punct-$reset " 

  PS2="$parens$char_304$text$char_304$punct-$reset "

  precmd () { setopt promptsubst }
  preexec () { }
}


             reply	other threads:[~2005-05-09 17:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-09 17:24 Bart Schaefer [this message]
2005-05-09 17:49 ` Peter Stephenson
2005-05-09 17:53   ` Clint Adams
2005-05-10  4:08   ` Bart Schaefer

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=1050509172451.ZM11220@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).