zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk, Roman Cheplyaka <roman.cheplyaka@gmail.com>
Subject: Re: completion bug in UTF-8 locale
Date: Sun, 20 Aug 2006 23:18:38 +0100	[thread overview]
Message-ID: <20060820231838.02e89c47.p.w.stephenson@ntlworld.com> (raw)
In-Reply-To: <20060820200808.GA4049@localdomain>

On Sun, 20 Aug 2006 23:08:08 +0300
Roman Cheplyaka <roman.cheplyaka@gmail.com> wrote:
> I've made some more tests. It seems to break at certain letters.. Try for
> example directory named "ц" (w/o quotes). 

Aha.  That needs one of the bytes to be encoded as a "Meta" byte (it
overlaps with zsh's range of internal tokens).

That's still broken in the patches I made for listing multibyte
characters quite recently; the following should fix it.  This means it's
not surprising it's buggy in 4.3.2.

Would you be able to try it with the code currently in CVS?  Otherwise
I'll probably make a pre-4.3.3 test version shortly.

In the following patch I've assumed that any null-terminated string must
be metafied.  That's the usual rule, but nothing would surprise me about
the completion code.

Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.94
diff -u -r1.94 complist.c
--- Src/Zle/complist.c	17 Aug 2006 09:34:12 -0000	1.94
+++ Src/Zle/complist.c	20 Aug 2006 22:17:13 -0000
@@ -621,7 +621,11 @@
 	if (ml == mlend - 1 && (cc % columns) == columns - 1)
 	    return 0;
 
-	putc(*p, shout);
+	if (*p == Meta) {
+	    p++;
+	    putc(*p ^ 32, shout);
+	} else
+	    putc(*p, shout);
 	if ((beg = !(cc % columns)))
 	    ml++;
 	if (mscroll && !(cc % columns) &&
@@ -1137,8 +1141,14 @@
 		    dopr = 0;
 		    continue;
 		}
-		while (len--)
-		    putc(*p++, shout);
+		while (len--) {
+		    if (*p == Meta) {
+			len--;
+			p++;
+			putc(*p++ ^ 32, shout);
+		    } else
+			putc(*p++, shout);
+		}
 		if ((beg = !(cc % columns)) && !stat) {
 		    ml++;
                     fputs(" \010", shout);
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.74
diff -u -r1.74 zle_tricky.c
--- Src/Zle/zle_tricky.c	20 Aug 2006 18:07:49 -0000	1.74
+++ Src/Zle/zle_tricky.c	20 Aug 2006 22:17:15 -0000
@@ -2123,9 +2123,15 @@
 			tcout(TCUNDERLINEEND);
 		    break;
 		case '{':
-		    for (p++; *p && (*p != '%' || p[1] != '}'); p++)
-			if (dopr)
+		    for (p++; *p && (*p != '%' || p[1] != '}'); p++) {
+			if (*p == Meta) {
+			    p++;
+			    if (dopr) 
+				putc(*p ^ 32, shout);
+			}
+			else if (dopr)
 			    putc(*p, shout);
+		    }
 		    if (*p)
 			p++;
 		    else
@@ -2164,8 +2170,14 @@
 		convchar_t cchar;
 		int clen = MB_METACHARLENCONV(p, &cchar);
 		if (dopr) {
-		    while (clen--)
-			putc(*p++, shout);
+		    while (clen--) {
+			if (*p == Meta) {
+			    p++;
+			    clen--;
+			    putc(*p++ ^ 32, shout);
+			} else
+			    putc(*p++, shout);
+		    }
 		} else
 		    p += clen;
 		cc += WCWIDTH(cchar);

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  reply	other threads:[~2006-08-20 22:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060820071833.GA3850@localdomain>
2006-08-20 17:01 ` Peter Stephenson
2006-08-20 20:08   ` Roman Cheplyaka
2006-08-20 22:18     ` Peter Stephenson [this message]
2006-08-26 18:24       ` David Gómez
2006-08-29 18:49         ` Peter Stephenson
2006-08-30 15:54           ` Peter Stephenson
2006-08-30 17:13             ` David Gómez

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=20060820231838.02e89c47.p.w.stephenson@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=roman.cheplyaka@gmail.com \
    --cc=zsh-workers@sunsite.dk \
    /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).