summary refs log tree commit diff
path: root/Completion/Zsh/Command
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-07-09 14:58:06 +0200
committerOliver Kiddle <opk@zsh.org>2015-07-09 14:58:06 +0200
commit5951ac13ed0fee0352a6bfcbcc78ea8c0ec8ad5f (patch)
tree5f53b3212cb9e5e11997edb9607a2554fd286f94 /Completion/Zsh/Command
parentbada2f9a211da65b6351f2f2d48de32b75f346f3 (diff)
downloadzsh-5951ac13ed0fee0352a6bfcbcc78ea8c0ec8ad5f.tar.gz
zsh-5951ac13ed0fee0352a6bfcbcc78ea8c0ec8ad5f.tar.xz
zsh-5951ac13ed0fee0352a6bfcbcc78ea8c0ec8ad5f.zip
35748: fixes to prompt spec completion where it contains date formats
Diffstat (limited to 'Completion/Zsh/Command')
-rw-r--r--Completion/Zsh/Command/_print17
1 files changed, 11 insertions, 6 deletions
diff --git a/Completion/Zsh/Command/_print b/Completion/Zsh/Command/_print
index 405393355..1eba13e88 100644
--- a/Completion/Zsh/Command/_print
+++ b/Completion/Zsh/Command/_print
@@ -11,7 +11,7 @@ if [[ $service = print ]]; then
     pflag='(-s -u -z)-p[print arguments to input of coprocess]'
 
   if [[ -n ${words[1,CURRENT][(r)-*P*]} ]]; then
-    rest='*: :_ps1234'
+    rest='*: :->prompt'
   else
     rest='*: :_default'
   fi
@@ -48,16 +48,17 @@ if [[ $state = printf ]]; then
 fi
 
 if [[ $state = printfformat ]]; then
-  if [[ ${(Q)PREFIX} = *%((-|)<->|[-#0 +*.])# ]]; then
+  if [[ ${(Q)PREFIX} = *%[0-9\$#\ +*.\'-]# ]]; then
     local -a specs
       specs=(
         '#:alternate form'
-        '0:zeropad to length n'
+        '0:zero pad to length'
         '-:left adjust result'
         ' :leave one space in front of positive number from signed conversion'
         '+:always place sign before a number from signed conversion'
         '*:field width in next argument'
         '.:precision'
+	"':thousand separators"
         'c:print the first character of the argument'
         's:print the argument as a string'
         {d,i}':signed decimal number or with leading " numeric value of following character'
@@ -73,12 +74,16 @@ if [[ $state = printfformat ]]; then
         'q:as %s but shell quote result'
       )
     compset -P "*"
-    _describe -t print-format-specifier 'print format specifier' specs -S ''
-    _message -e print-format-specifier 'number'
+    _describe -t print-format-specifiers 'print format specifier' specs -S ''
+    _message -e print-format-specifiers 'number'
   else
-    _describe -t print-format-specifier 'print format specifier' '(%)' -S ''
+    _wanted print-format-specifiers expl 'print format specifier' compadd -S '' %
   fi
   ret=0
+elif [[ $state = prompt ]]; then
+  _default && ret=0
+  # complete prompt specifiers without interfering too much with default completion
+  (( $#compstate[unambiguous] <= $#PREFIX || ! $#PREFIX )) && _ps1234 && ret=0
 fi
 
 return ret