Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Lots of test failures when --disable-multibyte



On Sun, Apr 3, 2022 at 7:03 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> ./D01prompt.ztst: starting.
> --- /tmp/zsh.ztst.159862/ztst.out    2022-04-03 18:48:45.714786786 -0700
> +++ /tmp/zsh.ztst.159862/ztst.tout    2022-04-03 18:48:45.718786838 -0700
> @@ -1 +1 @@
> -
> +V
> Test ./D01prompt.ztst failed: output differs from expected as shown above for:
>   print ${(%U)Y-%(v}
> Was testing: Regression test for test on empty psvar
> ./D01prompt.ztst: test failed.

Here's a patch for that one, bringing it in line with the multibyte branch.

diff --git a/Src/hist.c b/Src/hist.c
index d4557d424..f9440dba7 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2252,6 +2252,7 @@ casemodify(char *str, int how)
 #endif
     while (*str) {
         int c;
+        int mod = 0;
         if (*str == Meta) {
         c = str[1] ^ 32;
         str += 2;
@@ -2259,13 +2260,17 @@ casemodify(char *str, int how)
         c = *str++;
         switch (how) {
         case CASMOD_LOWER:
-        if (isupper(c))
+        if (isupper(c)) {
             c = tolower(c);
+            mod = 1;
+        }
         break;

         case CASMOD_UPPER:
-        if (islower(c))
+        if (islower(c)) {
             c = toupper(c);
+            mod = 1;
+        }
         break;

         case CASMOD_CAPS:
@@ -2273,14 +2278,18 @@ casemodify(char *str, int how)
         if (!ialnum(c))
             nextupper = 1;
         else if (nextupper) {
-            if (islower(c))
+            if (islower(c)) {
             c = toupper(c);
+            mod = 1;
+            }
             nextupper = 0;
-        } else if (isupper(c))
+        } else if (isupper(c)) {
             c = tolower(c);
+            mod = 1;
+        }
         break;
         }
-        if (imeta(c)) {
+        if (mod && imeta(c)) {
         *ptr2++ = Meta;
         *ptr2++ = c ^ 32;
         } else




Messages sorted by: Reverse Date, Date, Thread, Author