about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarlon Richert <marlonrichert@users.noreply.github.com>2021-11-12 21:52:18 +0200
committerOliver Kiddle <opk@zsh.org>2021-11-12 22:13:10 +0100
commitc7f4634549697a65af0dc82e97e8b066bfb81f6c (patch)
treef392ebeea2fbe1390a65c004e5a105ee368c013c
parent9c515a5a2f67e39b049d50e364ebfe17e536cc23 (diff)
downloadzsh-c7f4634549697a65af0dc82e97e8b066bfb81f6c.tar.gz
zsh-c7f4634549697a65af0dc82e97e8b066bfb81f6c.tar.xz
zsh-c7f4634549697a65af0dc82e97e8b066bfb81f6c.zip
49572: Let _expand preserve array form w/out zstyle glob
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Base/Completer/_expand2
-rw-r--r--Test/Y01completion.ztst11
3 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 350b23f9a..de6bbb08b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2021-11-12  Oliver Kiddle  <opk@zsh.org>
 
+	* Marlon: 49572: Completion/Base/Completer/_expand,
+	Test/Y01completion.ztst: Let _expand preserve array form w/out
+	zstyle glob
+
 	* unposted: Completion/Unix/Command/_ansible: fix case statement
 	fall-through for ansible-galaxy role completion
 
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand
index 86b4ac6e4..e5e4f9b39 100644
--- a/Completion/Base/Completer/_expand
+++ b/Completion/Base/Completer/_expand
@@ -105,7 +105,7 @@ subd=("$exp[@]")
 
 # We need to come out of this with consistent quoting, by hook or by crook.
 integer done_quote
-local orig_exp=$exp
+local -a orig_exp=( $exp )
 if [[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob; then
   eval 'exp=( ${~exp//(#b)\\([ 	\"'"\'"'
 ])/$match[1]} ); exp=( ${(q)exp} )' 2>/dev/null && (( $#exp )) && done_quote=1
diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
index 882a0adc4..6af0efc6d 100644
--- a/Test/Y01completion.ztst
+++ b/Test/Y01completion.ztst
@@ -62,6 +62,17 @@
 >line: {: dir1 dir2 file1 file2 }{}
 >line: {: *}{}
 
+  comptesteval $'zstyle \'*\' glob no'
+  comptesteval $'typeset -g tst=(*)'
+  comptest $': $tst\C-D'
+0:_expand preserves array form
+>DESCRIPTION:{expansions}
+>NO:{dir1}
+>NO:{dir2}
+>NO:{file1}
+>NO:{file2}
+
+  comptesteval $'zstyle -d \'*\' glob'
   comptesteval '_users () { compadd user1 user2 }'
   comptest $': ~\t\t\t\t\t'
 0:tilde