diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2002-07-01 08:25:15 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2002-07-01 08:25:15 +0000 |
commit | 053629183d8075c5bd122c9767f0b4f8bf8be870 (patch) | |
tree | 7285316b73b6f649e1febcebc30be0c4fdfa3e0b /Src | |
parent | 6278159f6dc177bdfd6a18779b081198d47a9a80 (diff) | |
download | zsh-053629183d8075c5bd122c9767f0b4f8bf8be870.tar.gz zsh-053629183d8075c5bd122c9767f0b4f8bf8be870.tar.xz zsh-053629183d8075c5bd122c9767f0b4f8bf8be870.zip |
add new sepcial context -assign-parameter- for completing the parameter in an assignment (17387)
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Zle/compcore.c | 2 | ||||
-rw-r--r-- | Src/Zle/zle_tricky.c | 25 | ||||
-rw-r--r-- | Src/zsh.h | 2 |
3 files changed, 23 insertions, 6 deletions
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 /******************************/ |