Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: context in completion widgets
- X-seq: zsh-workers 5928
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: context in completion widgets
- Date: Wed, 24 Mar 1999 14:03:00 +0100 (MET)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author