about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2022-09-27 15:20:24 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2022-09-27 15:20:24 +0900
commit33938ad489e6f3c280d431f92920db5a00458534 (patch)
treed24636ac64410b3b2135bd53391ab03a27a6e1c1
parent1e4c7bcae5daec29cbf85968e013576d665c3816 (diff)
downloadzsh-33938ad489e6f3c280d431f92920db5a00458534.tar.gz
zsh-33938ad489e6f3c280d431f92920db5a00458534.tar.xz
zsh-33938ad489e6f3c280d431f92920db5a00458534.zip
50668: treat 8bit chars correctly when multibyte is unset
The problem was found in character range, but may have existed in other
occasions
-rw-r--r--ChangeLog5
-rw-r--r--Src/utils.c2
-rw-r--r--Test/D09brace.ztst7
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 597fd9093..8679bf019 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-09-27  Jun-ichi Takimoto  <takimoto-j@kba.biglobe.ne.jp>
+
+	* 50668: Src/utils.c, Test/D09brace.ztst: treat 8bit characters
+	in charcter range correctly when multibyte is unset
+
 2022-09-26  Jun-ichi Takimoto  <takimoto-j@kba.biglobe.ne.jp>
 
 	* 50662: Test/ztst.zsh: unset LC_* for all the tests
diff --git a/Src/utils.c b/Src/utils.c
index 62bd3e602..edf5d3df7 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5519,7 +5519,7 @@ mb_metacharlenconv(const char *s, wint_t *wcp)
     if (!isset(MULTIBYTE) || STOUC(*s) <= 0x7f) {
 	/* treat as single byte, possibly metafied */
 	if (wcp)
-	    *wcp = (wint_t)(*s == Meta ? s[1] ^ 32 : *s);
+	    *wcp = (wint_t)STOUC(*s == Meta ? s[1] ^ 32 : *s);
 	return 1 + (*s == Meta);
     }
     /*
diff --git a/Test/D09brace.ztst b/Test/D09brace.ztst
index 580ed430f..961947b67 100644
--- a/Test/D09brace.ztst
+++ b/Test/D09brace.ztst
@@ -116,3 +116,10 @@
   print -r {1..10}{..
 0:Unmatched braces after matched braces are left alone.
 >1{.. 2{.. 3{.. 4{.. 5{.. 6{.. 7{.. 8{.. 9{.. 10{..
+
+  () {
+    setopt localoptions no_multibyte
+    echo -E {$'\x80'..$'\x81'}
+  }
+0:range of 8bit chars, multibyte option unset
+>\M-^@ \M-^A