zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: problems with 4.3.4 and Tru64
Date: Fri, 11 May 2007 18:56:02 +0100	[thread overview]
Message-ID: <20070511185602.f76af8ed.pws@csr.com> (raw)
In-Reply-To: <2DF07A7A-0112-1000-87C3-08869130C191-Webmail-10013@mac.com>

Jordan Breeding <jordan.breeding@mac.com> 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 ))

228

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
  arr=(${(s..)line})
  integer i
  for (( i = 1; i <= ${#arr}; i++)); do
    char=${arr[i]}
    (( #char > 127 )) && arr[i]="?"
  done
  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@csr.com>                  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


  reply	other threads:[~2007-05-11 17:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-10  8:25 Timo Aaltonen
2007-05-10  9:55 ` Peter Stephenson
2007-05-10 10:05   ` Peter Stephenson
2007-05-10 10:06   ` Timo Aaltonen
2007-05-10 10:15     ` Timo Aaltonen
2007-05-10 10:30       ` Peter Stephenson
2007-05-10 11:03         ` Timo Aaltonen
2007-05-10 11:30           ` Peter Stephenson
2007-05-10 11:43             ` Timo Aaltonen
2007-05-10 11:55               ` Peter Stephenson
2007-05-10 13:05                 ` Timo Aaltonen
2007-05-10 13:35                   ` Peter Stephenson
2007-05-13 20:12             ` Peter Stephenson
2007-05-13 23:43               ` Wayne Davison
2007-05-10 17:55 ` Phil Pennock
2007-05-10 19:24   ` Timo Aaltonen
2007-05-10 22:26     ` Phil Pennock
2007-05-11  9:28       ` Peter Stephenson
2007-05-11 16:23         ` Jordan Breeding
2007-05-11 17:25           ` Jordan Breeding
2007-05-11 17:56             ` Peter Stephenson [this message]
2007-05-11 18:42               ` Jordan Breeding

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=20070511185602.f76af8ed.pws@csr.com \
    --to=pws@csr.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).