zsh-workers
 help / color / mirror / code / Atom feed
* tab comlpetion bug
@ 2002-04-12 21:23 Jeremy M. Dolan
  2002-04-12 21:35 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy M. Dolan @ 2002-04-12 21:23 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

zsh tab complete seems to be choking on a files with ! in them, if
you manually start typing the name with a double quote. Ex:

 % mkdir q
 % cd q
 % touch 'aaa!bbb'
 % touch 'aaa!ccc'
 % cd "aa          <-- this much is typed
   *hit tab*
 % 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.
But it seems to me it's a bug if at first zsh is replacing it with
something it matches, then it no longer matches anything.

This is with zsh 4.0.2 (included in RHL 7.2).
% rpm -q zsh
zsh-4.0.2-2

Someone else I told was also able to reproduce.

Thanks.

-- 
Jeremy M. Dolan <mailto:jmd@pobox.com> <http://turbogeek.org/>
PGP: 1024D/DC433DEE 494C 7A6E 19FB 026A 1F52  E0D5 5C5D 6228 DC43 3DEE

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: tab comlpetion bug
  2002-04-12 21:23 tab comlpetion bug Jeremy M. Dolan
@ 2002-04-12 21:35 ` Bart Schaefer
  2002-04-16  7:50   ` Sven Wischnowsky
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2002-04-12 21:35 UTC (permalink / raw)
  To: Jeremy M. Dolan; +Cc: zsh-workers

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.


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

* Re: tab comlpetion bug
  2002-04-12 21:35 ` Bart Schaefer
@ 2002-04-16  7:50   ` Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 2002-04-16  7:50 UTC (permalink / raw)
  To: zsh-workers


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@berkom.de


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

end of thread, other threads:[~2002-04-16  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-12 21:23 tab comlpetion bug Jeremy M. Dolan
2002-04-12 21:35 ` Bart Schaefer
2002-04-16  7:50   ` Sven Wischnowsky

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