about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-04-25 11:05:52 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2015-04-25 11:05:52 -0700
commit54fe61ab32435081d9f08510e3fa4375f55fbe81 (patch)
tree418e0c20c5b4d0976432b73d4221173b589678d2
parent87e76f89bbb48be2e941c112fa34e4ef6709dbd2 (diff)
downloadzsh-54fe61ab32435081d9f08510e3fa4375f55fbe81.tar.gz
zsh-54fe61ab32435081d9f08510e3fa4375f55fbe81.tar.xz
zsh-54fe61ab32435081d9f08510e3fa4375f55fbe81.zip
34961: unquote history words when command line has a quote
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Base/Completer/_history7
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c0787674b..b518a33a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-04-25  Barton E. Schaefer  <schaefer@zsh.org>
 
+	* 34961: Completion/Base/Completer/_history: unquote history words
+	when command line has a quote
+
 	* 34961: Completion/compaudit: properly handle the case of finding
 	no files when searching $fpath and $_compdir
 
diff --git a/Completion/Base/Completer/_history b/Completion/Base/Completer/_history
index 63878ac1c..cd69ca17b 100644
--- a/Completion/Base/Completer/_history
+++ b/Completion/Base/Completer/_history
@@ -51,9 +51,14 @@ ISUFFIX=
 # We skip the first element of historywords so the current word doesn't
 # interfere with the completion
 
+local -a hslice
 while [[ $compstate[nmatches] -eq 0 && beg -lt max ]]; do
+  if [[ -n $compstate[quote] ]]
+  then hslice=( ${(Q)historywords[beg,beg+slice]} )
+  else hslice=( ${historywords[beg,beg+slice]} )
+  fi
   _wanted "$opt" history-words expl 'history word' \
-      compadd -Q -a 'historywords[beg,beg+slice]'
+      compadd -Q -a hslice
   (( beg+=slice ))
 done