Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: problems with 4.3.4 and Tru64

Jordan Breeding <jordan.breeding@xxxxxxx> wrote:
> Sorry to reply to myself, but I just paid a little bit more attention
> and I figured out something else interesting.  The extra characters
> that appear in the Terminal itself just before the output from echo
> are the multibyte characters only, which are missing from the ${1}
> being inserted into the Terminal title.  This part seems to be OS X
> (Terminal.app) specific, as if I use zsh through a remote Terminal
> the behaviour will differ (putty will display
> h<character><character>lp in the title which I am assuming are just
> the bytes that it is seeing).  Anyway, I will probably just not use
> preexec() anymore for now.  Is there are way to display multibyte
> characters as the base singlebyte character for the preexec string?
> Or possible just replace multibyte characters with "?" or something,
> just so my preexec would at least partially work?

I'm glad things are working better... I'd be happy to put any generic
workarounds in the shell itself, but it's probably too difficult for
a terminal-specific problem, if that's what this is.

As for detecting multibyte characters:  presumably all characters with
codes over 127 are going to be multibyte, so it is possible to detect
such a string:

% foo="ä"
% print $(( #foo ))


However, this just tests the first character; you'd have to loop over the
entire string to do it which is a bit of a nuisance:

  local line=${(%):-'\e]2;%n@%m %0~ (%30>...>'${1}'%>>%)\a'} char
  local -a arr
  integer i
  for (( i = 1; i <= ${#arr}; i++)); do
    (( #char > 127 )) && arr[i]="?"
  print -n ${(j..)arr}

(I did test this.)  I wonder if the shell is misinterpreting codes within
the ${1} in

  print -Pn "\e]2;%n@%m %0~ (%30>...>${1}%>>%)\a"

?  If you just do print -P "<string>" from the command line with
what was in ${1} does everything look OK?  (This is rather a long shot;
I don't see how the shell could misplace characters like that, but
it might be getting the handling of characters sufficiently wrong
that the terminal driver is getting confused.)

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview

Messages sorted by: Reverse Date, Date, Thread, Author