zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _subscript: fix the completion of associative array keys
@ 2016-01-26  6:49 Eric Cook
  2016-01-26  7:18 ` Eric Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Cook @ 2016-01-26  6:49 UTC (permalink / raw)
  To: zsh-workers

iirc the way ${(P)var} works was changed/"fix"(?) recently, but i can't find
the thread now so i may be wrong. But currently: $options[<tab>
completes values not the keys.
---
 Completion/Zsh/Context/_subscript | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript
index 0ccc0c4..5e898d8 100644
--- a/Completion/Zsh/Context/_subscript
+++ b/Completion/Zsh/Context/_subscript
@@ -81,7 +81,7 @@ elif compset -P '\('; then
 elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
   local suf MATCH MBEGIN MEND
   local -a keys
-  keys=(${${(kP)compstate[parameter]}//(#m)[\$\\\[\]\(\)\[\{\}]/\\$MATCH})
+  keys=(${${(k)${(P)compstate[parameter]}}//(#m)[\$\\\[\]\(\)\[\{\}]/\\$MATCH})
   keys=(${keys//#%(#m)[*@]/(e)$MATCH})
   [[ "$RBUFFER" != (|\\)\]* ]] && suf="$osuf"
 
-- 
2.6.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] _subscript: fix the completion of associative array keys
  2016-01-26  6:49 [PATCH] _subscript: fix the completion of associative array keys Eric Cook
@ 2016-01-26  7:18 ` Eric Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Cook @ 2016-01-26  7:18 UTC (permalink / raw)
  To: zsh-workers

On 01/26/2016 01:49 AM, Eric Cook wrote:
> iirc the way ${(P)var} works was changed/"fix"(?) recently, but i can't find
> the thread now so i may be wrong. But currently: $options[<tab>
> completes values not the keys.

Now without empty argument removal: typeset -A foo; foo=('' bar) # is legal.
diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript
index 0ccc0c4..679f129 100644
--- a/Completion/Zsh/Context/_subscript
+++ b/Completion/Zsh/Context/_subscript
@@ -81,8 +81,8 @@ elif compset -P '\('; then
 elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
   local suf MATCH MBEGIN MEND
   local -a keys
-  keys=(${${(kP)compstate[parameter]}//(#m)[\$\\\[\]\(\)\[\{\}]/\\$MATCH})
-  keys=(${keys//#%(#m)[*@]/(e)$MATCH})
+  keys=("${(@)${(@k)${(P)compstate[parameter]}}//(#m)[\$\\\[\]\(\)\[\{\}]/\\$MATCH}")
+  keys=("${(@)keys//#%(#m)[*@]/(e)$MATCH}")
   [[ "$RBUFFER" != (|\\)\]* ]] && suf="$osuf"

   _wanted association-keys expl 'association key' \


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-26  7:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-26  6:49 [PATCH] _subscript: fix the completion of associative array keys Eric Cook
2016-01-26  7:18 ` Eric Cook

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