diff options
author | Oliver Kiddle <opk@zsh.org> | 2016-11-05 00:27:47 +0100 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2016-11-05 00:27:47 +0100 |
commit | 4b41e33cbcf8027b53ecae4467dc9232becb0420 (patch) | |
tree | 61697eb6efad6cec81919f761d9238037c4c154b /Completion/Zsh/Command | |
parent | fe023d8bac1912e96a4d982ba84a0621fde616d2 (diff) | |
download | zsh-4b41e33cbcf8027b53ecae4467dc9232becb0420.tar.gz zsh-4b41e33cbcf8027b53ecae4467dc9232becb0420.tar.xz zsh-4b41e33cbcf8027b53ecae4467dc9232becb0420.zip |
39389: when printf -v is used with an array use separate elements each time the format is reused
Diffstat (limited to 'Completion/Zsh/Command')
-rw-r--r-- | Completion/Zsh/Command/_print | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Completion/Zsh/Command/_print b/Completion/Zsh/Command/_print index 38f17ab8e..8df094107 100644 --- a/Completion/Zsh/Command/_print +++ b/Completion/Zsh/Command/_print @@ -1,15 +1,18 @@ #compdef print printf -local state expl line eflag pflag rest ret=1 +local state expl line eflag pflag rflag rest ret=1 if [[ $service = print ]]; then # -e flag available only after -R eflag="${words[1,CURRENT-1][(r)-*R*]:+-e[enable escapes]}" + rflag='-r[ignore escape conventions of echo]' # -p flag only relevant if we have a coprocess (:>&p) 2>/dev/null && pflag='(-s -u -z)-p[print arguments to input of coprocess]' + [[ -n ${words[(r)-*f]} ]] && rflag='-r[disable reuse of format string]' + if [[ -n ${words[1,CURRENT][(r)-*P*]} ]]; then rest='*: :->prompt' else @@ -17,11 +20,11 @@ if [[ $service = print ]]; then fi _arguments -C -s -A "-*" -S \ - '(-f)-r[ignore escape conventions of echo]' \ + '-r[ignore escape conventions of echo]' \ '(-r -b -f -m -s -l -N -o -O -i -c -u -p -z -D -P)-R[emulate BSD echo (no escapes, -n & -e flags only)]' \ '-b[recognise bindkey escape sequences]' \ - '-m[remove arguments matching specified pattern]' \ - '(-r -n -R -l -N -c)-f+[print arguments as for the printf builtin]:format:->printfformat' \ + '-m[remove arguments not matching specified pattern]:pattern' \ + '(-n -R -l -N -c)-f+[print arguments as for the printf builtin]:format:->printfformat' \ '(-u -p -z)-s[place results in the history list]' \ '(-c -f)-n[do not add a newline to the result]' \ '(-N -c -f)-l[print arguments separated by newlines]' \ @@ -33,11 +36,13 @@ if [[ $service = print ]]; then '(-n -l -N -f -C -s -z)-c[print arguments in columns]' \ '(-n -l -N -f -c -s -z)-C+[print arguments in specified number of columns]:columns' \ '(-s -p -z)-u+[specify file descriptor to print arguments to]:file descriptor:_file_descriptors' \ - '-v[store output in named parameter]:parameter:_parameters' \ + '(-s -z -p -u)-v[store output in named parameter]:parameter:_parameters' \ '(-s -p -u)-z[push arguments onto editing buffer stack]' \ '-D[substitute any arguments which are named directories using ~ notation]' \ '-P[perform prompt expansion]' \ - $pflag $eflag $rest && ret=0 + '(-X -f -a -C -c -z)-x+[expand leading tabs]:tab width' \ + '(-x -f -a -C -c -z)-X+[expand all tabs]:tab width' \ + $pflag $eflag $rflag $rest && ret=0 elif [[ $service = printf ]]; then state=printf fi |