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

Re: Bug: Wrong completion of $(( $(!cmd



Peter Stephenson <pws@xxxxxxx> wrote:
> Geoff Wing wrote:
> > On Saturday 2007-01-06 23:48 +1100, J_rg Sommer output:
> > :% echo 12
> > :12
> > :% echo $(( $(!echo<TAB>
> > :% echo $($(( $(echo 12
> > 
> > and inungetc() just after gives me 11 lines of
> > 	Warning: backing up wrong character.
> 
> The problem is somewhere here (in lex.c).  If dquote_parse() returns
> non-zero it's an error indication, not a character, so the hungetc(c) is
> definitely wrong in that case.  However, I don't understand the
> intention behind error handling at this point.  I think we probably need
> to return 1 earlier.

Is it this simple?  Seems to do the trick...

Index: Src/lex.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/lex.c,v
retrieving revision 1.37
diff -u -r1.37 lex.c
--- Src/lex.c	19 Jan 2007 21:36:03 -0000	1.37
+++ Src/lex.c	23 Jan 2007 13:08:47 -0000
@@ -542,14 +542,14 @@
     c = dquote_parse(')', 0);
     cmdpop();
     *bptr = '\0';
-    if (!c) {
-	c = hgetc();
-	if (c == ')')
-	    return 1;
-	hungetc(c);
-	lexstop = 0;
-	c = ')';
-    }
+    if (c)
+	return 1;
+    c = hgetc();
+    if (c == ')')
+	return 1;
+    hungetc(c);
+    lexstop = 0;
+    c = ')';
     hungetc(c);
     lexstop = 0;
     while (len > oldlen) {

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview



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