zsh-workers
 help / color / mirror / code / Atom feed
* Re: Completion listing multibyte bug? was: Re: Simple Tip of the Day
       [not found] <237967ef0512021807w74299bb3j85c0f6c3b099722c@mail.gmail.com>
@ 2005-12-10 20:45 ` Peter Stephenson
  2005-12-11 10:54   ` Mikael Magnusson
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2005-12-10 20:45 UTC (permalink / raw)
  To: Zsh Hackers' List

On Sat, 3 Dec 2005 03:07:18 +0100
Mikael Magnusson <mikachu@gmail.com> wrote:
> I just noticed while sorting some mp3's that cd -<tab> lists multibyte
> paths wrong:

I believe this fixes the problem.  This is an old bug: it would be wrong
with metafied characters even without multibyte support.

Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.78
diff -u -r1.78 complist.c
--- Src/Zle/complist.c	15 Nov 2005 08:44:18 -0000	1.78
+++ Src/Zle/complist.c	10 Dec 2005 20:43:03 -0000
@@ -879,10 +879,12 @@
 	    fmt = mlistp;
     }
     for (p = fmt; *p; p++) {
-	if (doesc && *p == '%') {
-	    if (*++p) {
+	int chr = (*p == Meta) ? *++p ^ 32 : *p;
+	if (doesc && chr == '%') {
+	    chr = (*++p == Meta) ? *++p ^ 32 : *p;
+	    if (chr) {
 		m = 0;
-		switch (*p) {
+		switch (chr) {
 		case '%':
 		    if (dopr == 1)
 			putc('%', shout);
@@ -929,7 +931,7 @@
 		case '{':
 		    for (p++; *p && (*p != '%' || p[1] != '}'); p++)
 			if (dopr)
-			    putc(*p, shout);
+			    putc(*p == Meta ? *++p ^ 32 : *p, shout);
 		    if (*p)
 			p++;
 		    else
@@ -1006,9 +1008,9 @@
 	    } else
 		break;
 	} else {
-	    if ((++cc == columns - 2 || *p == '\n') && stat)
+	    if ((++cc == columns - 2 || chr == '\n') && stat)
 		dopr = 2;
-	    if (*p == '\n') {
+	    if (chr == '\n') {
 		if (dopr == 1 && mlbeg >= 0 && tccan(TCCLEAREOL))
 		    tcout(TCCLEAREOL);
 		l += 1 + ((cc - 1) / columns);
@@ -1019,7 +1021,7 @@
 		    dopr = 0;
 		    continue;
 		}
-		putc(*p, shout);
+		putc(chr, shout);
 		if ((beg = !(cc % columns)) && !stat) {
 		    ml++;
                     fputs(" \010", shout);

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page still at http://www.pwstephenson.fsnet.co.uk/


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Completion listing multibyte bug? was: Re: Simple Tip of the Day
  2005-12-10 20:45 ` Completion listing multibyte bug? was: Re: Simple Tip of the Day Peter Stephenson
@ 2005-12-11 10:54   ` Mikael Magnusson
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Magnusson @ 2005-12-11 10:54 UTC (permalink / raw)
  To: Zsh Hackers' List

On 12/10/05, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> On Sat, 3 Dec 2005 03:07:18 +0100
> Mikael Magnusson <mikachu@gmail.com> wrote:
> > I just noticed while sorting some mp3's that cd -<tab> lists multibyte
> > paths wrong:
>
> I believe this fixes the problem.  This is an old bug: it would be wrong
> with metafied characters even without multibyte support.

confirmed this fixes my bug.

--
Mikael Magnusson


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-12-11 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <237967ef0512021807w74299bb3j85c0f6c3b099722c@mail.gmail.com>
2005-12-10 20:45 ` Completion listing multibyte bug? was: Re: Simple Tip of the Day Peter Stephenson
2005-12-11 10:54   ` Mikael Magnusson

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).