zsh-workers
 help / color / mirror / code / Atom feed
* completion after assignment
@ 2017-09-25 13:45 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2017-09-25 13:45 UTC (permalink / raw)
  To: Zsh workers

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

.


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

only message in thread, other threads:[~2017-09-25 15:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-25 13:45 completion after assignment Oliver Kiddle

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).