From: Wayne Davison <wayned@users.sourceforge.net>
To: zsh-workers@sunsite.dk
Subject: Re: mangling of non-ascii char in prompt
Date: Fri, 13 Jan 2006 01:47:56 -0800 [thread overview]
Message-ID: <20060113094755.GA1852@dot.blorf.net> (raw)
In-Reply-To: <20060113022347.GA32762@dot.blorf.net>
[-- Attachment #1: Type: text/plain, Size: 390 bytes --]
On Thu, Jan 12, 2006 at 06:23:47PM -0800, Wayne Davison wrote:
> The problem appears to be that the UTF-8 string coming from %D{%a} is
> not being metafied
Attached are some fixes I just checked in. They fix this problem in the
prompt, and some similar problems in the zsh/datetime and zsh/stat
modules, both of which needed to metafy values when they were put into
variables.
..wayne..
[-- Attachment #2: meta.patch --]
[-- Type: text/plain, Size: 1873 bytes --]
--- prompt.c 12 Jan 2006 00:51:41 -0000 1.32
+++ prompt.c 13 Jan 2006 09:43:46 -0000 1.34
@@ -543,6 +543,9 @@ putpromptchar(int doprint, int endchar)
if (ztrftime(bp, t0, tmfmt, tm) >= 0)
break;
}
+ /* There is enough room for this because addbufspc(t0)
+ * allocates room for t0 * 2 bytes. */
+ metafy(bp, -1, META_NOALLOC);
bp += strlen(bp);
free(tmbuf);
tmbuf = NULL;
--- Modules/datetime.c 7 Dec 2004 16:55:10 -0000 1.11
+++ Modules/datetime.c 13 Jan 2006 09:02:43 -0000 1.12
@@ -67,7 +67,7 @@ bin_strftime(char *nam, char **argv, Opt
}
if (scalar) {
- setsparam(scalar, ztrdup(buffer));
+ setsparam(scalar, metafy(buffer, -1, META_DUP));
} else {
printf("%s\n", buffer);
}
--- Modules/stat.c 19 Dec 2005 11:35:44 -0000 1.10
+++ Modules/stat.c 13 Jan 2006 09:15:59 -0000 1.11
@@ -570,11 +570,11 @@ bin_stat(char *name, char **args, Option
if (iwhich > -1) {
statprint(&statbuf, outbuf, *args, iwhich, flags);
if (arrnam)
- *arrptr++ = ztrdup(outbuf);
+ *arrptr++ = metafy(outbuf, -1, META_DUP);
else if (hashnam) {
/* STF_NAME explicitly turned off for ops.ind['H'] above */
*hashptr++ = ztrdup(statelts[iwhich]);
- *hashptr++ = ztrdup(outbuf);
+ *hashptr++ = metafy(outbuf, -1, META_DUP);
} else
printf("%s\n", outbuf);
} else {
@@ -582,11 +582,11 @@ bin_stat(char *name, char **args, Option
for (i = 0; i < ST_COUNT; i++) {
statprint(&statbuf, outbuf, *args, i, flags);
if (arrnam)
- *arrptr++= ztrdup(outbuf);
+ *arrptr++= metafy(outbuf, -1, META_DUP);
else if (hashnam) {
/* STF_NAME explicitly turned off for ops.ind['H'] above */
*hashptr++ = ztrdup(statelts[i]);
- *hashptr++ = ztrdup(outbuf);
+ *hashptr++ = metafy(outbuf, -1, META_DUP);
} else
printf("%s\n", outbuf);
}
prev parent reply other threads:[~2006-01-13 9:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-12 2:29 Clint Adams
2006-01-12 4:01 ` Andrey Borzenkov
2006-01-13 0:45 ` Clint Adams
2006-01-13 2:23 ` Wayne Davison
2006-01-13 9:47 ` Wayne Davison [this message]
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=20060113094755.GA1852@dot.blorf.net \
--to=wayned@users.sourceforge.net \
--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).