zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: context in completion widgets
@ 1999-03-24 13:03 Sven Wischnowsky
  0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 1999-03-24 13:03 UTC (permalink / raw)
  To: zsh-workers


Playing with `_expand' some more showed a bug in the completion code:
it didn't copy the value of `inwhat'. The parameter expansion magic in 
`_expand' made this be set and later tests in tricky.c ended up
thinking they were in a math environment.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Wed Mar 24 13:41:56 1999
+++ Src/Zle/zle_tricky.c	Wed Mar 24 13:58:43 1999
@@ -520,7 +520,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;
+static int lincmd, linredir, ispar, linwhat;
 
 /* The string for the redirection operator. */
 
@@ -4111,7 +4111,7 @@
 	compparameter = compredirect = "";
 	if (ispar)
 	    compcontext = (ispar == 2 ? "brace_parameter" : "parameter");
-	else if (inwhat == IN_MATH) {
+	else if (linwhat == IN_MATH) {
 	    if (insubscr) {
 		compcontext = "subscript";
 		if (varname) {
@@ -4133,7 +4133,7 @@
 		compredirect = rdstr;
 	    set |= CP_REDIRECT;
 	} else
-	    switch (inwhat) {
+	    switch (linwhat) {
 	    case IN_ENV:
 		compcontext = "array_value";
 		compparameter = varname;
@@ -4201,7 +4201,7 @@
 	zsfree(compprefix);
 	zsfree(compsuffix);
 	if (unset(COMPLETEINWORD)) {
-	    if (inwhat == IN_MATH)
+	    if (linwhat == IN_MATH)
 		tmp = s;
 	    else
 		tmp = quotename(s, NULL);
@@ -4211,7 +4211,7 @@
 	} else {
 	    char *ss = s + offs, sav;
 	    
-	    if (inwhat == IN_MATH)
+	    if (linwhat == IN_MATH)
 		tmp = s;
 	    else
 		tmp = quotename(s, &ss);
@@ -4351,6 +4351,8 @@
     } else
 	compmatcher = 0;
 
+    linwhat = inwhat;
+
     /* Walk through the global matchers. */
     for (;;) {
 	bmatchers = NULL;
@@ -4582,15 +4584,15 @@
 
     ccont = CC_CCCONT;
 
-    if (inwhat == IN_ENV) {
+    if (linwhat == IN_ENV) {
         /* Default completion for parameter values. */
         cc = &cc_default;
-    } else if (inwhat == IN_MATH) {
+    } else if (linwhat == IN_MATH) {
         /* Parameter names inside mathematical expression. */
         cc_dummy.mask = CC_PARAMS;
 	cc = &cc_dummy;
 	cc_dummy.refc = 10000;
-    } else if (inwhat == IN_COND) {
+    } else if (linwhat == IN_COND) {
 	/* We try to be clever here: in conditions we complete option   *
 	 * names after a `-o', file names after `-nt', `-ot', and `-ef' *
 	 * and file names and parameter names elsewhere.                */

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-03-24 13:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-24 13:03 PATCH: context in completion widgets 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).