diff options
author | Oliver Kiddle <opk@zsh.org> | 2015-07-23 07:24:03 +0200 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2015-07-23 07:24:03 +0200 |
commit | 346fcf9b96c7b52df9a9d9a4a453aa1bb35808fb (patch) | |
tree | 68eeea709127ddd9765674480b6c856f78f51d6d /Completion/Zsh | |
parent | c55fe219990e948a9f5bf09f9ffc462a9da086ea (diff) | |
download | zsh-346fcf9b96c7b52df9a9d9a4a453aa1bb35808fb.tar.gz zsh-346fcf9b96c7b52df9a9d9a4a453aa1bb35808fb.tar.xz zsh-346fcf9b96c7b52df9a9d9a4a453aa1bb35808fb.zip |
35753: allow for numbers after the ( in ternary expressions and fix backslash quoting
Diffstat (limited to 'Completion/Zsh')
-rw-r--r-- | Completion/Zsh/Type/_ps1234 | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Completion/Zsh/Type/_ps1234 b/Completion/Zsh/Type/_ps1234 index 125a62152..8edf0d0cb 100644 --- a/Completion/Zsh/Type/_ps1234 +++ b/Completion/Zsh/Type/_ps1234 @@ -4,9 +4,7 @@ local -a specs local expl grp cols bs suf pre changed=1 ret=1 local -A ansi -if [[ -z $compstate[quote] ]]; then - bs='\' # in patterns we use (\\|) widely as print -P handles backslashes first -fi +[[ -z $compstate[quote] ]] && bs='\' # first strip off any complete prompt specifications leaving only the # current, incomplete, one @@ -15,10 +13,10 @@ while (( changed )); do compset -P '%[DFK](\\|){[^}]#}' && changed=1 # formats with arg: %x{...} compset -P '%[0-9-\\]#[^DFK(0-9-<>\\\[]' && changed=1 # normal formats compset -P '%[0-9-\\]#(<[^<]#<|>[^>]#>|\[[^\]]#\])' && changed=1 # truncations - compset -P '%[0-9-\\]#(\\|)\([0-9]#[^0-9]?|[^%]' && changed=1 # start of ternary + compset -P '%[0-9-\\]#(\\|)\([0-9-]#[^0-9]?|[^%]' && changed=1 # start of ternary compset -P '[^%]##' && changed=1 # sundry other characters # %D/%F/%K without a following { ... } - [[ $PREFIX = %(-|)<->#[DFK](\\|)[^{\\]* ]] && + [[ $PREFIX = %(-|)<->#[DFK](\\[^{]|[^{\\])* ]] && compset -P '%[0-9\\-]#[DFK]' && changed=1 done [[ $PREFIX = %(-|)<->[FK](#e) ]] && compset -P '*' # F/K with number @@ -59,12 +57,12 @@ if compset -P '%[FK]'; then fi fi -if compset -P '%[0-9-\\]#\([0-9]#[^0-9]'; then +if compset -P '%[0-9-\\]#(\\|)\([0-9-]#[^0-9]'; then compset -S '*' _delimiters && ret=0 elif compset -P '%[0-9-\\]#[<>\]]'; then _message -e replacements 'replacement string' -elif compset -P '%[0-9-\\]#(\\|)\([0-9]#'; then +elif compset -P '%[0-9-\\]#(\\|)\([0-9-]#'; then compset -S '[.:+/-%]*' || suf=( -S . ) compset -S '*' specs=( @@ -90,7 +88,9 @@ elif compset -P '%[0-9-\\]#(\\|)\([0-9]#'; then 'V:element n of psvar is set and non-empty' 'w:day of week (Sunday = 0)' ) - _describe -t ternary-prompt-expressions 'ternary prompt format test character' specs $suf && ret=0 + [[ $IPREFIX != *- ]] && _describe -t ternary-prompt-expressions \ + 'ternary prompt format test character' specs $suf && ret=0 + _message -e numbers number elif compset -P '%D(\\|){'; then compset -S '(\\|)}*' _date_formats zsh && ret=0 @@ -164,8 +164,7 @@ then fi _describe -t prompt-format-specifiers 'prompt format specifier' \ specs -S '' $pre && ret=0 - (( ! $#pre )) && [[ -prefix '(-|)<->' ]] && - _message -e prompt-format-specifiers number + (( ! $#pre )) && _message -e prompt-format-specifiers number fi return ret |