From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Lots of test failures when --disable-multibyte
Date: Mon, 4 Apr 2022 14:10:38 -0700 [thread overview]
Message-ID: <CAH+w=7Z2VaxNct0y2acbvSv=D5rbnQYpOYwgiBoTc-UpnCxOWw@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Ycqt+3L=FaoRX2Q7_OuWtfN--od6upENnOL=NAhVmYHQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 425 bytes --]
On Mon, Apr 4, 2022 at 8:31 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> Remaining are that ${(V)...} doesn't output the same format in
> single-byte mode, and that {$'\\0'..$'\\C-?'} doesn't expand to a
> range.
Here's a patch for the {a..z} discrepancy. nicechar() now prefers the
^C format to \C-C, in line with multibyte. I left a comment behind to
note a branch that seemingly never occurs in single-byte?
[-- Attachment #2: bracechardots.txt --]
[-- Type: text/plain, Size: 1658 bytes --]
diff --git a/Src/glob.c b/Src/glob.c
index d4ffc2274..ca28f20e8 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -2220,7 +2220,7 @@ bracechardots(char *str, convchar_t *c1p, convchar_t *c2p)
#ifdef MULTIBYTE_SUPPORT
cstart == WEOF ||
#else
- !cstart ||
+ !*pconv ||
#endif
pnext[0] != '.' || pnext[1] != '.')
return 0;
@@ -2241,7 +2241,7 @@ bracechardots(char *str, convchar_t *c1p, convchar_t *c2p)
#ifdef MULTIBYTE_SUPPORT
cend == WEOF ||
#else
- !cend ||
+ !*pconv ||
#endif
*pnext != Outbrace)
return 0;
@@ -2305,22 +2305,19 @@ xpandbraces(LinkList list, LinkNode *np)
strp = str - str3;
lenalloc = strp + strlen(str2+1) + 1;
do {
-#ifdef MULTIBYTE_SUPPORT
char *ncptr;
int nclen;
+#ifdef MULTIBYTE_SUPPORT
mb_charinit();
ncptr = wcs_nicechar(cend, NULL, NULL);
+#else
+ ncptr = nicechar(cend);
+#endif
nclen = strlen(ncptr);
p = zhalloc(lenalloc + nclen);
memcpy(p, str3, strp);
memcpy(p + strp, ncptr, nclen);
strcpy(p + strp + nclen, str2 + 1);
-#else
- p = zhalloc(lenalloc + 1);
- memcpy(p, str3, strp);
- sprintf(p + strp, "%c", cend);
- strcat(p + strp, str2 + 1);
-#endif
insertlinknode(list, last, p);
if (rev) /* decreasing: add in reverse order. */
last = nextnode(last);
diff --git a/Src/utils.c b/Src/utils.c
index f9127c70c..66cb2a63a 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -557,9 +557,14 @@ nicechar(int c)
*s++ = '\\';
c = 't';
} else if (c < 0x20) {
- *s++ = '\\';
- *s++ = 'C';
- *s++ = '-';
+ /*
+ if (quotable) {
+ *s++ = '\\';
+ *s++ = 'C';
+ *s++ = '-';
+ } else
+ */
+ *s++ = '^';
c += 0x40;
}
done:
next prev parent reply other threads:[~2022-04-04 21:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 2:03 Bart Schaefer
2022-04-04 14:43 ` Peter Stephenson
2022-04-04 15:31 ` Bart Schaefer
2022-04-04 16:23 ` Peter Stephenson
2022-04-04 21:10 ` Bart Schaefer [this message]
2022-04-04 21:45 ` Bart Schaefer
2022-04-04 22:00 ` Bart Schaefer
2022-04-05 16:00 ` Bart Schaefer
2022-04-05 16:15 ` Mikael Magnusson
2022-04-05 20:29 ` Peter Stephenson
2022-04-06 3:48 ` Bart Schaefer
2022-04-06 5:32 ` ZTST_continue (was Re: Lots of test failures when --disable-multibyte) Jun T
2022-04-06 13:37 ` Peter Stephenson
2022-04-07 12:33 ` Jun T
2022-04-07 12:34 ` Jun T
2022-04-04 18:52 ` Lots of test failures when --disable-multibyte Bart Schaefer
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='CAH+w=7Z2VaxNct0y2acbvSv=D5rbnQYpOYwgiBoTc-UpnCxOWw@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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).