From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16508 invoked by alias); 9 Jul 2015 15:25:35 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35753 Received: (qmail 28135 invoked from network); 9 Jul 2015 15:25:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1436455212; bh=5P8y3yKsuq+5bel61YPPdKpPD/Q4AGAKqp4eiXZ6Cck=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=I7e9KTkVBWes24GSGfkuyXEhN/IXjnVndYMlGMXS4Tfr4T9/oNXBVqlpEAkGJ8WDAv16JJwZs7cVeCIqtKXDUJ7dm4s6JGrws/Xe+S5cdJMV0iV0SYAKqCJQ9A9rw+V6DCUTrTfubyUkb+MyNgLgEwASKKIuNeEa3oj5HfMUxClhTbptXZ16LrAsDeRJlz67qwS4XZyk6KTY5kxXDijYIdrCUOFDJsVcXU1yWwi364ovm83uTQCPJz8O7K+P+YnUngJn4JY36KKZ3mHjQ7F39WzEkIXzMIsCPW207F6e+/ViIu5qT8j5SZ4e1xQs2lvF8EaiptHhLKk0ClJKXH2LiA== X-Yahoo-Newman-Id: 748620.82408.bm@smtp113.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Etfbt2UVM1k_FdOM5a.WPBfP_FV4_D76Q.sB8uaU8UGXMF4 TJy9wE4A480wMiR.ylDlhzOHtMvyXxUB5RG8QoWd4AjjDj4cV7v56jUMqbo4 TTafmWNusotbwz2R2BdhrZBhxsHPPTNbG3Ck45xvAP4sXlU2e7v5n4ssTA3q JIHeUDfmPywao775xzGkW4PFzAOJ18yhCiXMvdWarx0oWaaDGMOBjLGHNqNp w0ns0KYwguAFvon6ScS8OeBWYokmhyORH9QmAW_AoJJDqbopIFg20NhoGA9f B1nC32JhdZULd2Wq4A8fFKpGvLIHHUTPqJXmXriIQrTRAgqD2gwuPv2jsN1k Bp9EhoU5VPDbagLjfmwwLihp0ub6ILmIo2kslj_DiaHhHM_JrNm_jc5iiAxu eBHkdEqo5jH5Llc5Ck_aRis450ye3xtiWpQNoL_mFaVYzCO91pOmW1Nomt08 BXLrYLuewtVnClIXLwv6gvaVQPi5uYfwqxAU8f5WZCpAE61sFlALXXbe3Qa8 V8ZR6LjFwKG1nG2Cd7avKmVtXQGO3GA-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: From: Oliver Kiddle References: <1436143012-9243-1-git-send-email-mikachu@gmail.com> <4740.1436181110@thecus.kiddle.eu> <97E3F4A3-6951-4848-8711-B8BD609BA79D@kba.biglobe.ne.jp> <21764.1436444277@thecus.kiddle.eu> To: zsh workers Subject: Re: PATCH: _ps1234, _date_formats: Complete strftime formats for %D{} MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24601.1436455211.1@thecus.kiddle.eu> Date: Thu, 09 Jul 2015 17:20:11 +0200 Message-ID: <24602.1436455211@thecus.kiddle.eu> Mikael Magnusson wrote: > PS1='%( no longer tells me "--- number", how is this an > improvement? It now completes delimiters after PS1='%(3 which I > would also not consider an improvement :). I never realised the numbers were also allowed after the (. I've always had them before. > There doesn't seem to be a way to get back to completing anything > after print -P %D\\\{ (pressing tab at this point just deletes two > backslashes for me, and typing more things does nothing). It's > probably not a common thing to do though, so if it's complicated then > don't worry about it on my account. That wasn't too complicated. > Let's hope nobody ever tries to use print -rP. Completing for PS1 is just the same. If you really want to fix this, check $service, set a variable to (\\|) and use it with the ~ flag. Oliver diff --git a/Completion/Zsh/Type/_ps1234 b/Completion/Zsh/Type/_ps1234 index 8d3c5d8..f182a16 100644 --- a/Completion/Zsh/Type/_ps1234 +++ b/Completion/Zsh/Type/_ps1234 @@ -3,9 +3,7 @@ local -a specs local expl bs suf pre changed=1 ret=1 -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 @@ -14,10 +12,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-\\]#(\\|)\(??|[^%]' && 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 @@ -45,12 +43,12 @@ if compset -P '%[FK]'; then fi fi -if compset -P '%[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-\\]#(\\|)\('; then +elif compset -P '%[0-9-\\]#(\\|)\([0-9-]#'; then compset -S '[.:+/-%]*' || suf=( -S . ) compset -S '*' specs=( @@ -76,7 +74,9 @@ elif compset -P '%[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 @@ -150,8 +150,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