From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: PATCH: displaying wide characters
Date: Fri, 21 Oct 2005 10:03:52 +0100 [thread overview]
Message-ID: <20051021100352.4467ba69.pws@csr.com> (raw)
In-Reply-To: <1051020150255.ZM6346@candle.brasslantern.com>
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Looks like an off-by-one error somewhere.
>
> *** /tmp/zsh.ztst.out.4543 Thu Oct 20 08:00:11 2005
> --- /tmp/zsh.ztst.tout.4543 Thu Oct 20 08:00:11 2005
> ***************
> *** 1,2 ****
> ! start ...d at 10 Not truncated ...
> ! start truncat... Not truncated ...
> --- 1,2 ----
> ! start ...d at 10 Not truncated ..
> ! start truncat... Not truncated ..
> Test ../../zsh-4.0/Test/D01prompt.ztst failed: output differs from expected as
> shown above for:
> print -P 'start %10<...<truncated at 10%<< Not truncated%3< ...<Not shown'
> print -P 'start %10>...>truncated at 10%>> Not truncated%3> ...>Not shown'
> Was testing: prompt truncation
It looks like it, but it isn't. I didn't change the old code here, and
this feature is in 4.2. I was going by the manual:
%<string<
%>string>
%[xstring]
...
If the string is longer than the specified truncation
length, it will appear in full, completely replacing
the truncated string.
which is unambiguous, so I presume there is a bug in the old code. Even
more confusingly, it does the following (in both 4.2 and the non-multibyte
code):
% print -P '%10<0123456789<truncated at 10'
0123456789
% print -P '%10>0123456789abcde>truncated at 10'
0123456789
% print -P '%10<0123456789abcdef<truncated at 10'
truncated at 100
May be I should rewrite the code in the other branch to be more like the
code I just added. Unless anyone wants to argue the manual is wrong? (The
last output is certainly a bug.) I suspect it's too minor to worry much
about and I should just fix the old code. The only time I can think of
where this is significant is if you have a string with a variable
truncation length or truncation indicator so can't guarantee in advance
this won't happen, which must be fairly unlikely.
--
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
This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
next prev parent reply other threads:[~2005-10-21 9:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-19 20:31 Peter Stephenson
2005-10-19 20:41 ` Peter Stephenson
2005-10-20 0:39 ` Mikael Magnusson
2005-10-20 9:39 ` Peter Stephenson
2005-10-20 15:02 ` Bart Schaefer
2005-10-21 9:03 ` Peter Stephenson [this message]
2005-10-21 14:39 ` Bart Schaefer
2005-10-21 22:29 ` Peter Stephenson
2005-10-24 8:40 ` Mikael Magnusson
2005-10-24 9:07 ` Peter Stephenson
2005-10-24 12:41 ` Mikael Magnusson
2005-10-24 12:47 ` Peter Stephenson
2005-10-24 16:53 ` Peter Stephenson
2005-10-25 23:11 ` Peter Stephenson
2005-10-26 5:19 ` Mikael Magnusson
2005-10-26 9:17 ` Peter Stephenson
2005-10-26 14:31 ` Mikael Magnusson
2005-10-28 12:03 ` Peter Stephenson
2005-10-28 17:19 ` Mikael Magnusson
2005-10-19 22:47 ` 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=20051021100352.4467ba69.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).