summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--Completion/Zsh/Context/.distfiles2
-rw-r--r--Completion/Zsh/Context/_assign3
-rw-r--r--Doc/Zsh/compsys.yo4
-rw-r--r--Doc/Zsh/compwid.yo3
-rw-r--r--Src/Zle/compcore.c2
-rw-r--r--Src/Zle/zle_tricky.c25
-rw-r--r--Src/zsh.h2
8 files changed, 43 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index fd8beb086..d4d213167 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2002-07-01  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 17387: Completion/Zsh/Context/.distfiles,
+	Completion/Zsh/Context/_assign, Doc/Zsh/compsys.yo,
+	Doc/Zsh/compwid.yo, Src/zsh.h, Src/Zle/compcore.c,
+	Src/Zle/zle_tricky.c: add new sepcial context
+	-assign-parameter- for completing the parameter in an
+	assignment
+
 2002-06-26  Bart Schaefer  <schaefer@zsh.org>
 
 	* 17357: Src/mkbltnmlst.sh: predefine autoloads for zsh emulation
diff --git a/Completion/Zsh/Context/.distfiles b/Completion/Zsh/Context/.distfiles
index b844887d6..59777c30d 100644
--- a/Completion/Zsh/Context/.distfiles
+++ b/Completion/Zsh/Context/.distfiles
@@ -1,6 +1,6 @@
 DISTFILES_SRC='
 .distfiles
-_autocd
+_assign           _autocd
 _brace_parameter  _equal            _math             _subscript
 _condition        _first            _parameter        _tilde
 _default          _in_vared         _redirect         _value
diff --git a/Completion/Zsh/Context/_assign b/Completion/Zsh/Context/_assign
new file mode 100644
index 000000000..4935cc9cf
--- /dev/null
+++ b/Completion/Zsh/Context/_assign
@@ -0,0 +1,3 @@
+#compdef -assign-parameter-
+
+_parameters -g "^*readonly*" -S ''
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 323473dfd..94e846121 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -2515,6 +2515,10 @@ item(tt(-brace-parameter-))(
 for completing the name of a parameter expansion within braces
 (`tt(${...})').
 )
+kindex(-assign-parameter-, completion context)
+item(tt(-assign-parameter-))(
+for completing the name of a parameter in an assignment.
+)
 kindex(-command-, completion context)
 item(tt(-command-))(
 for completing in a command position.
diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo
index a26386f09..298d0739c 100644
--- a/Doc/Zsh/compwid.yo
+++ b/Doc/Zsh/compwid.yo
@@ -158,6 +158,9 @@ item(tt(brace_parameter))(
 when completing the name of a parameter in a parameter expansion beginning
 with tt(${).
 )
+item(tt(assign_parameter))(
+when completing the name of a parameter in a parameter assignment.
+)
 item(tt(command))(
 when completing for a normal command (either in command position or for
 an argument of the command).
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index fbf1339f1..e0aef2864 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -553,6 +553,8 @@ callcompfunc(char *s, char *fn)
 	compparameter = compredirect = "";
 	if (ispar)
 	    compcontext = (ispar == 2 ? "brace_parameter" : "parameter");
+        else if (linwhat == IN_PAR)
+            compcontext = "assign_parameter";
 	else if (linwhat == IN_MATH) {
 	    if (insubscr) {
 		compcontext = "subscript";
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index a007be3e9..56518f514 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1256,12 +1256,25 @@ get_comp_string(void)
 		insubscr = 2;
 	    else
 		insubscr = 1;
-	} else if (*s == '=' && cs > wb + (s - tt)) {
-	    s++;
-	    wb += s - tt;
-	    t0 = STRING;
-	    s = ztrdup(s);
-	    inwhat = IN_ENV;
+	} else if (*s == '=') {
+            if (cs > wb + (s - tt)) {
+                s++;
+                wb += s - tt;
+                s = ztrdup(s);
+                inwhat = IN_ENV;
+            } else {
+                char *p = s;
+
+                if (p[-1] == '+')
+                    p--;
+                sav = *p;
+                *p = '\0';
+                inwhat = IN_PAR;
+                s = ztrdup(tt);
+                *p = sav;
+                we = wb + p - tt;
+            }
+            t0 = STRING;
 	}
 	lincmd = 1;
     }
diff --git a/Src/zsh.h b/Src/zsh.h
index 504fd1396..1697e26a0 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1318,6 +1318,8 @@ struct histent {
 #define IN_COND    3
 /* In a parameter assignment (e.g. `foo=bar'). */
 #define IN_ENV     4
+/* In a parameter name in an assignment. */
+#define IN_PAR     5
 
 
 /******************************/