zsh-workers
 help / color / mirror / code / Atom feed
* Re: foo=<TAB> always gives context array_value
@ 1999-04-26  8:26 Sven Wischnowsky
  1999-04-26  9:53 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 1999-04-26  8:26 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> It seems that if I try to complete after an assignment, e.g.
>   foo=<TAB>
> (with new completion, obviously) $compstate[context] is always array_value,
> even if there is a character which is not `(' after the =.
> 
> Presumably the correct behaviour is that context `value' is assumed unless
> there is a ( present.

Of course. We lost that on the way...

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Fri Apr 23 13:28:11 1999
+++ Src/Zle/zle_tricky.c	Mon Apr 26 10:14:43 1999
@@ -555,7 +555,7 @@
 /* These are flags saying if we are completing in the command *
  * position, in a redirection, or in a parameter expansion.   */
 
-static int lincmd, linredir, ispar, linwhat;
+static int lincmd, linredir, ispar, linwhat, linarr;
 
 /* The string for the redirection operator. */
 
@@ -1128,7 +1128,7 @@
 static char *
 get_comp_string(void)
 {
-    int t0, tt0, i, j, k, cp, rd, sl, ocs, ins, oins, inarr, ia, parct;
+    int t0, tt0, i, j, k, cp, rd, sl, ocs, ins, oins, ia, parct;
     char *s = NULL, *linptr, *tmp, *p, *tt = NULL;
 
     zsfree(brbeg);
@@ -1192,7 +1192,7 @@
 	inpush(dupstrspace((char *) linptr), 0, NULL);
 	strinbeg();
 	stophist = 2;
-	i = tt0 = cp = rd = ins = oins = inarr = parct = ia = 0;
+	i = tt0 = cp = rd = ins = oins = linarr = parct = ia = 0;
 
 	/* This loop is possibly the wrong way to do this.  It goes through *
 	 * the previously massaged command line using the lexer.  It stores *
@@ -1211,11 +1211,11 @@
 	    linredir = (inredir && !ins);
 	    oins = ins;
 	    /* Get the next token. */
-	    if (inarr)
+	    if (linarr)
 		incmdpos = 0;
 	    ctxtlex();
 	    if (tok == ENVARRAY) {
-		inarr = 1;
+		linarr = 1;
 		zsfree(varname);
 		varname = ztrdup(tokstr);
 	    } else if (tok == INPAR)
@@ -1224,7 +1224,7 @@
 		if (parct)
 		    parct--;
 		else
-		    inarr = 0;
+		    linarr = 0;
 	    }
 	    if (inredir)
 		rdstr = tokstrings[tok];
@@ -1267,7 +1267,7 @@
 		clwpos = i;
 		cp = lincmd;
 		rd = linredir;
-		ia = inarr;
+		ia = linarr;
 		if (inwhat == IN_NOTHING && incond)
 		    inwhat = IN_COND;
 	    } else if (linredir)
@@ -4257,7 +4257,7 @@
 	} else
 	    switch (linwhat) {
 	    case IN_ENV:
-		compcontext = "array_value";
+		compcontext = (linarr ? "array_value" : "value");
 		compparameter = varname;
 		set |= CP_PARAMETER;
 		if (!clwpos) {

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


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

* Re: foo=<TAB> always gives context array_value
  1999-04-26  8:26 foo=<TAB> always gives context array_value Sven Wischnowsky
@ 1999-04-26  9:53 ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 1999-04-26  9:53 UTC (permalink / raw)
  To: zsh-workers

On Apr 26, 10:26am, Sven Wischnowsky wrote:
} Subject: Re: foo=<TAB> always gives context array_value
}
} @@ -555,7 +555,7 @@
}  /* These are flags saying if we are completing in the command *
}   * position, in a redirection, or in a parameter expansion.   */
}  
} -static int lincmd, linredir, ispar, linwhat;
} +static int lincmd, linredir, ispar, linwhat, linarr;

OK, I have to ask ... what does the leading `l' stand for in all those
names except `ispar'?

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


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

* Re: foo=<TAB> always gives context array_value
@ 1999-04-26 11:01 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-04-26 11:01 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On Apr 26, 10:26am, Sven Wischnowsky wrote:
> } Subject: Re: foo=<TAB> always gives context array_value
> }
> } @@ -555,7 +555,7 @@
> }  /* These are flags saying if we are completing in the command *
> }   * position, in a redirection, or in a parameter expansion.   */
> }  
> } -static int lincmd, linredir, ispar, linwhat;
> } +static int lincmd, linredir, ispar, linwhat, linarr;
> 
> OK, I have to ask ... what does the leading `l' stand for in all those
> names except `ispar'?

Historical reasons... most of them were `local' copies of the variables
without the `l' that were used elsewhere. Now, that's a bit stupid,
since `inarr' is used only in tricky.c, I didn't see the `ispar' and
wanted to make it consistent. But in a certain sense it is: those with 
the `l' are set when parsing is done (real parsing) and thus give a
hint where to look (well, at least for those who know the code). But
`ispar' is the flag set in `check_param()' which tests if we are
completing in a parameter expansion for the new style completion --
and doesn't have to do with *real* parsing.

It might be argued that we should rename `ispar' to `lispar' or rename 
`linarr' to `inarr', though. (Although the current state might help me 
to remember what's going on.)

Bye
 Sven


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


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

* foo=<TAB> always gives context array_value
@ 1999-04-23 14:57 Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 1999-04-23 14:57 UTC (permalink / raw)
  To: Zsh hackers list

It seems that if I try to complete after an assignment, e.g.
  foo=<TAB>
(with new completion, obviously) $compstate[context] is always array_value,
even if there is a character which is not `(' after the =.

Presumably the correct behaviour is that context `value' is assumed unless
there is a ( present.

(Probably this didn't get noticed because there is no default -value-
handler.)

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


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

end of thread, other threads:[~1999-04-26 11:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-26  8:26 foo=<TAB> always gives context array_value Sven Wischnowsky
1999-04-26  9:53 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
1999-04-26 11:01 Sven Wischnowsky
1999-04-23 14:57 Peter Stephenson

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