zsh-workers
 help / color / mirror / code / Atom feed
* A minor glitch with _arguments
@ 2001-05-01  3:54 Bart Schaefer
  2001-05-02  9:21 ` Sven Wischnowsky
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2001-05-01  3:54 UTC (permalink / raw)
  To: zsh-workers

Putting quotes around an option string convinces _arguments that it has
reached the end of the options.  E.g. using zsh's configure script as a
test case:

zsh% ./configure '--enable-dynamic' --<TAB>
No matches for `corrections'

Remove the quotes, or move the left one even one character to the right,
and everything starts completing again.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: A minor glitch with _arguments
  2001-05-01  3:54 A minor glitch with _arguments Bart Schaefer
@ 2001-05-02  9:21 ` Sven Wischnowsky
  2001-05-02 15:13   ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 2001-05-02  9:21 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:

> Putting quotes around an option string convinces _arguments that it has
> reached the end of the options.  E.g. using zsh's configure script as a
> test case:
> 
> zsh% ./configure '--enable-dynamic' --<TAB>
> No matches for `corrections'
> 
> Remove the quotes, or move the left one even one character to the right,
> and everything starts completing again.

The problem is that compwords contains the words from the line as they
appear there, including quotes.  We had a lot of discussion about the
ups and downs of that which I don't want to revive.

The patch makes comparguments remove one level of quoting.  Was there a
simpler way to achieve that?

Bye
  Sven

Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.50
diff -u -r1.50 computil.c
--- Src/Zle/computil.c	2001/04/26 12:13:37	1.50
+++ Src/Zle/computil.c	2001/05/02 09:18:29
@@ -1317,6 +1317,12 @@
 	dopt = NULL;
 	doff = state.singles = arglast = 0;
 
+        /* remove quotes */
+        line = dupstring(line);
+        parse_subst_string(line);
+        remnulargs(line);
+        untokenize(line);
+
 	if (ca_inactive(d, argxor, cur, 0, NULL) ||
 	    ((d->flags & CDF_SEP) && cur != compcurrent && !strcmp(line, "--"))) {
 	    if (ca_inactive(d, NULL, cur, 1, NULL))

-- 
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: A minor glitch with _arguments
  2001-05-02  9:21 ` Sven Wischnowsky
@ 2001-05-02 15:13   ` Bart Schaefer
  2001-05-03  7:10     ` Sven Wischnowsky
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2001-05-02 15:13 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

On May 2, 11:21am, Sven Wischnowsky wrote:
} Subject: Re: A minor glitch with _arguments
}
} > Putting quotes around an option string convinces _arguments that it has
} > reached the end of the options.  E.g. using zsh's configure script as a
} > test case:
} > 
} > zsh% ./configure '--enable-dynamic' --<TAB>
} > No matches for `corrections'
} 
} The patch makes comparguments remove one level of quoting.  Was there a
} simpler way to achieve that?

I think this cure is worse than the disease:

schaefer<509> ../zsh-4.0/configure '--e<TAB>
schaefer<509> ../zsh-4.0/configure --e 
_arguments:191: unmatched '
schaefer<509> ../zsh-4.0/configure '--e


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: A minor glitch with _arguments
  2001-05-02 15:13   ` Bart Schaefer
@ 2001-05-03  7:10     ` Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2001-05-03  7:10 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:

> ...
> 
> I think this cure is worse than the disease:
> 
> schaefer<509> ../zsh-4.0/configure '--e<TAB>
> schaefer<509> ../zsh-4.0/configure --e 
> _arguments:191: unmatched '
> schaefer<509> ../zsh-4.0/configure '--e

How embarrassing.


Bye
  Sven

Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.51
diff -u -r1.51 computil.c
--- Src/Zle/computil.c	2001/05/02 09:23:07	1.51
+++ Src/Zle/computil.c	2001/05/03 07:08:55
@@ -1253,7 +1253,7 @@
     Caopt ptr, wasopt = NULL, dopt;
     struct castate state;
     char *line, *pe, **argxor = NULL;
-    int cur, doff, argend, arglast;
+    int cur, doff, argend, arglast, ne;
     Patprog endpat = NULL, napat = NULL;
     LinkList sopts = NULL;
 
@@ -1319,7 +1319,10 @@
 
         /* remove quotes */
         line = dupstring(line);
+        ne = noerrs;
+        noerrs = 2;
         parse_subst_string(line);
+        noerrs = ne;
         remnulargs(line);
         untokenize(line);
 

-- 
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

end of thread, other threads:[~2001-05-03  7:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-01  3:54 A minor glitch with _arguments Bart Schaefer
2001-05-02  9:21 ` Sven Wischnowsky
2001-05-02 15:13   ` Bart Schaefer
2001-05-03  7:10     ` 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).