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

Re: bug in completion/expansion of files with LANG=C



Here's a patch to fix the first part of having non-convertable
characters found when completing filenames:  we now output the full
filename string instead of a truncated version of it.  I chose to just
call nicechar() to have it output a \M-x sequence (to make it the same
as the non-multibyte code).

However, I was wondering if it would be nicer to switch both the old and
the new code over to using a 3-digit octal value in such output?  E.g.
output "\303" instead of "\M-C", and "\201" instead of "\M-^A"?

..wayne..
--- Src/utils.c	15 Dec 2005 14:51:41 -0000	1.108
+++ Src/utils.c	7 Jan 2006 22:36:34 -0000
@@ -3475,22 +3475,21 @@ mb_niceformat(const char *s, FILE *strea
 
 	if (ret == (size_t)-1 || ret == (size_t)-2)
 	{
+	    /* The byte didn't convert, so output it as a \M-x sequence. */
+	    fmt = nicechar(*(unsigned char*)ptr);
+	    ret = newl = 1;
+	} else {
 	    /*
-	     * We're a bit stuck here.  I suppose we could
-	     * just stick with \M-... for the individual bytes.
+	     * careful in case converting NULL returned 0: NULLs are
+	     * real characters for us.
 	     */
-	    break;
+	    if (c == L'\0' && ret == 0)
+		ret = 1;
+	    fmt = wcs_nicechar(c, &newl, NULL);
 	}
-	/*
-	 * careful in case converting NULL returned 0: NULLs are real
-	 * characters for us.
-	 */
-	if (c == L'\0' && ret == 0)
-	    ret = 1;
+
 	umlen -= ret;
 	ptr += ret;
-
-	fmt = wcs_nicechar(c, &newl, NULL);
 	l += newl;
 
 	if (stream)


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