Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

completion after assignment



I was experimenting with completion in associative array assignments and
it appears that things are broken even before the recent var=( []=.. )
stuff.

_value wants to alternate between association keys and values
(defaulting to filenames) but it appears to do association keys in both
the first and second words before it starts to alternate. Something has
gone wrong with indexing of the first element. I can trace this back
to 36025 which was a hack at this area of code to allow for completion
after something like
  RPS2=$PS2; unset PS2 ; setopt <TAB>
I've no idea how to fix that.

Completion also looks wrong in the case of assoc[key]=<TAB>. I think the
following patch is the correct way to address that.

Oliver

diff --git a/Completion/Zsh/Context/_value b/Completion/Zsh/Context/_value
index 22372ab36..5e74100c6 100644
--- a/Completion/Zsh/Context/_value
+++ b/Completion/Zsh/Context/_value
@@ -22,7 +22,7 @@ if [[ "$service" != -value-,* ]]; then
             -value-,{${compstate[parameter]},-default-},${^strs}
 else
   if [[ "$compstate[parameter]" != *-* &&
-        "$compstate[context]" = *value &&
+        "$compstate[context]" = array_value &&
         "${(Pt)${compstate[parameter]}}" = assoc* ]]; then
     local expl
     if (( CURRENT & 1 )); then

.



Messages sorted by: Reverse Date, Date, Thread, Author