From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8459 invoked by alias); 23 Oct 2016 04:46:32 -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: 39710 Received: (qmail 25425 invoked from network); 23 Oct 2016 04:46:32 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f173.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.217.173):SA:0(0.0/5.0):. Processed in 0.892751 secs); 23 Oct 2016 04:46:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject:cc :mime-version; bh=D9V359QxJL0cwaHrHMdD2HDLZrL45W/kBsZImSX5Sh0=; b=SiRE1wulC62YHsO7f7HFmv1BUIIx5sNvoh38ViuR5LINVtRCoC6+EuHP9SQRToqqhJ SpFbi2/C6bU3Z6x1xnXJ/nvn+vw8aerSKDXba+e196RkOdWO02txL+TDzXlefbAPsjD0 W53TJj5zyqT4/5K8jOSjd/S9gx68qjq45NWc9WxUBUAwzNNw+wui1cobMWId7MKwTwNN FGFMWQlf/oHjfa4GeNH57SKp2aLX8ElGIVNppNXreRL1K0I/adS26UU9sW1mjjYJfU9P 5gvaufltpI+vZD2KFFapNJK2U22oYoISg+mSY2RkZOdvcKRzCCFU+EW0GHGU1WcuWPTN WqGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:cc:mime-version; bh=D9V359QxJL0cwaHrHMdD2HDLZrL45W/kBsZImSX5Sh0=; b=BTLVMOZvO8whkm0PEjD/pM3npSdTdg7oYrmF2IE2hzGm/9A///oILleKxwLA5XFxl0 wzYNutaLNtGRLZ8BmgPH3cGqbiHR4TeMsgcT2dVtOXz0g128LbRO6M7Q2oaoq4mTJPdC A05W3eOPxGvX3+aEWc8g4d33/iMmtM6GFF/b+R2r5MRgvALN4lWQStyf2DlZvfzadBnM 9b4wZbpoSsYtlgT0iOZGZ9RFeb2joidrxLzWkC+Maifz6BMd4wmjZ9jFhg/9utsMfwAa wqG5GCp/eT56AT9I9xRzTjDXzMTzVqVL4nAd7xkeAK3mMaMUPOZKxX3rIndKjxMbBjUy cy4w== X-Gm-Message-State: ABUngvcTHmZvOhGCpLxK+7zY7hx1zi0V5ffwS5QGOGdohP2hqXg/QRcb9GpTUwCWm7lhsQ== X-Received: by 10.176.82.161 with SMTP id v30mr3796400uav.23.1477197982999; Sat, 22 Oct 2016 21:46:22 -0700 (PDT) From: Bart Schaefer Message-Id: <161022214628.ZM7665@torch.brasslantern.com> Date: Sat, 22 Oct 2016 21:46:28 -0700 In-Reply-To: Comments: In reply to Alex George "[BUG] _expand completer's all-expansions tag format style does not expand %o" (Oct 19, 10:19pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: [BUG] _expand completer's all-expansions tag format style does not expand %o Cc: Alex George MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 19, 10:19pm, Alex George wrote: } } [...] the all-expansions tag does not actually expand %o unlike the } expansions tag. } } I believe the problem is the lack of a } } _description all-expansions expl all-expansions "o:$word" } } line in Completion/Base/Completer/_expand. Yes, that's essentially correct. However, there are a few nuances. The _requested call at line 210 makes a call to _description, passing along the (expl 'all expansions') arguments. However, _requested doesn't handle passing the additional formatting strings along to _description, so it's necessary to drop those two arguments from _requested and make an explicit call to _description instead, handling the "menu" style as is done for "_requested expansions". I note in passing that it doesn't make sense to have a tag-specific format style unless one also has a group-name style, because in the absence of group-name all the matches end up in group "-default-" and all the format strings get displayed together above that, and not necessarily in related order, which can be quite distracting. As mentioned in users/21955, I don't understand why a single match was being excluded from the expansions tag but included in all-expansions? diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand index e52144c..a6e30e8 100644 --- a/Completion/Base/Completer/_expand +++ b/Completion/Base/Completer/_expand @@ -181,7 +181,7 @@ if [[ -z "$compstate[insert]" ]] ;then else _tags all-expansions expansions original - if [[ $#exp -gt 1 ]] && _requested expansions; then + if [[ $#exp -ge 1 ]] && _requested expansions; then local i j normal space dir if [[ "$sort" = menu ]]; then @@ -207,9 +207,14 @@ else (( $#space )) && compadd "$expl[@]" -UQ -qS " " -a space (( $#normal )) && compadd "$expl[@]" -UQ -qS "" -a normal fi - if _requested all-expansions expl 'all expansions'; then + if _requested all-expansions; then local disp dstr + if [[ "$sort" = menu ]]; then + _description all-expansions expl 'all expansions' "o:$word" + else + _description -V all-expansions expl 'all expansions' "o:$word" + fi if [[ "${#${exp}}" -ge COLUMNS ]]; then disp=( -ld dstr ) dstr=( "${(r:COLUMNS-5:)exp} ..." ) diff --git a/Completion/Base/Completer/_user_expand b/Completion/Base/Completer/_user_expand index 066e2e8..ee39bb1 100644 --- a/Completion/Base/Completer/_user_expand +++ b/Completion/Base/Completer/_user_expand @@ -121,9 +121,14 @@ else (( $#space )) && compadd "$expl[@]" -UQ -qS " " -a space (( $#normal )) && compadd "$expl[@]" -UQ -qS "" -a normal fi - if _requested all-expansions expl "all expansions${REPLY:+: $REPLY}"; then + if _requested all-expansions; then local disp dstr + if [[ "$sort" = menu ]]; then + _description all-expansions expl "all expansions${REPLY:+: $REPLY}" "o:$word" + else + _description -V all-expansions expl "all expansions${REPLY:+: $REPLY}" "o:$word" + fi if [[ "${#${exp}}" -ge COLUMNS ]]; then disp=( -ld dstr ) dstr=( "${(r:COLUMNS-5:)exp} ..." )