Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: displaying wide characters
- X-seq: zsh-workers 21897
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: PATCH: displaying wide characters
- Date: Fri, 21 Oct 2005 10:03:52 +0100
- In-reply-to: <1051020150255.ZM6346@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: Cambridge Silicon Radio
- References: <200510192031.j9JKVYk7010115@xxxxxxxxxxxxxxxxx> <200510192041.j9JKfTJZ010450@xxxxxxxxxxxxxxxxx> <237967ef0510191739t103352a9vad735334a790d8b5@xxxxxxxxxxxxxx> <EXCHANGE03zfSLZZInL00006f40@xxxxxxxxxxxxxxxxxx> <1051020150255.ZM6346@xxxxxxxxxxxxxxxxxxxxxxx>
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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@xxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author