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

Re: EILSEQ in the C locale? (Was: $(<nofile) doesn't set $? to non-zero)



On Mar 15,  7:25am, Stephane Chazelas wrote:
}
} Maybe some optimisation could be done and things like mbstowc()
} avoided when MB_CUR_MAX is 1 or something like that?

The following seems to work for this particular case ($#var) but there
are other places where we walk a wide char array with mbrtowc() so this
is not complete.

diff --git a/Src/utils.c b/Src/utils.c
index 3b589aa..ba78f29 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5496,7 +5496,7 @@ mb_metastrlenend(char *ptr, int width, char *eptr)
     wchar_t wc;
     int num, num_in_char, complete;
 
-    if (!isset(MULTIBYTE))
+    if (!isset(MULTIBYTE) || MB_CUR_MAX == 1)
 	return eptr ? (int)(eptr - ptr) : ztrlen(ptr);
 
     laststart = ptr;



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