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

Re: tab comlpetion bug



Bart Schaefer wrote:

> On Fri, 12 Apr 2002, Jeremy M. Dolan wrote:
> 
> >  % cd "aaa\!       <-- what zsh changes it to
> >    *hit tab again*
> >
> > No matches found. It works ok if I don't put the " at the begining.
> 
> It works if you "setopt no_bang_hist", or if you use single quotes (but
> note that if you're using the new completion system it won't work exactly
> as you have it there, because the argument to "cd" must be a directory).
> 
> The problem is that inside the completion system zsh doesn't know that the
> backslash in front of the exclamation point is there solely for the
> purpose of preventing a history expansion.  So it is trying to complete
> files whose names contain a literal backslash-bang.

I think the real bug was that the lexer code and get_comp_string()
still treated bangs in double quotes specially, even though history
expansion was already tried. Since this the non-special treatment *is*
special to the completion code the patch below make get_comp_string()
treat backslashed bangs in double quotes specially.


Bye
  Sven

Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.35
diff -u -r1.35 zle_tricky.c
--- Src/Zle/zle_tricky.c	13 Mar 2002 09:28:05 -0000	1.35
+++ Src/Zle/zle_tricky.c	16 Apr 2002 07:51:09 -0000
@@ -1404,6 +1404,12 @@
 	    qisuf = n;
 	}
 	autoq = ztrdup(q);
+
+        if (instring == 2) {
+            for (q = s; *q; q++)
+                if (*q == '\\' && q[1] == '!')
+                    *q = Bnull;
+        }
     }
     /* While building the quoted form, we also clean up the command line. */
     for (p = s, tt = qword, i = wb, j = 0; *p; p++, tt++, i++)

-- 
Sven Wischnowsky                          wischnow@xxxxxxxxx



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