Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] _expand completer's all-expansions tag format style does not expand %o
- X-seq: zsh-workers 39710
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [BUG] _expand completer's all-expansions tag format style does not expand %o
- Date: Sat, 22 Oct 2016 21:46:28 -0700
- Cc: Alex George <xzeroknightx@xxxxxxxxx>
- 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==
- In-reply-to: <CANKG6XqAmBFKHbmWjCGyNyXhU129p7eHLaF0oV9Ebk-a7=tmjw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CANKG6XqAmBFKHbmWjCGyNyXhU129p7eHLaF0oV9Ebk-a7=tmjw@mail.gmail.com>
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} ..." )
Messages sorted by:
Reverse Date,
Date,
Thread,
Author