Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: _sep_parts
- X-seq: zsh-workers 9765
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: _sep_parts
- Date: Wed, 16 Feb 2000 17:42:02 +0100 (MET)
- In-reply-to: Peter Stephenson's message of Tue, 15 Feb 2000 21:58:59 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Peter Stephenson wrote:
> There seems to be a typo in _sep_parts, which I was trying out for the
> guide.
>
> By the way, there also seems to be a problem if one of the separators
> contains a character that needs quoting: completion quotes it, but
> _sep_parts doesn't recognise the quoted string as being the separator when
> performing later completions --- there's no use quoting it by hand, since
> it gets requoted. Maybe there's an easy workaround, else judicious use of
> -Q may be required, which _sep_parts doesn't accept. Not that I have an
> application for this, anyway.
This should fix it.
Bye
Sven
P.S.: Does it have `Don't panic' on its back?
diff -ru ../z.old/Completion/Core/_sep_parts Completion/Core/_sep_parts
--- ../z.old/Completion/Core/_sep_parts Wed Feb 16 12:40:34 2000
+++ Completion/Core/_sep_parts Wed Feb 16 17:40:11 2000
@@ -57,7 +57,7 @@
# Get the matching array elements.
- PREFIX="${str%%${sep}*}"
+ PREFIX="${str%%(|\\)${sep}*}"
builtin compadd -O testarr - "${(@P)arr}"
[[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
compadd -O testarr - "${(@P)arr}"
@@ -129,7 +129,7 @@
[[ $#tmparr -eq 0 && -n "$_comp_correct" ]] &&
compadd -O tmparr - "${(@P)arr}"
- suffixes=("${(@)^suffixes[@]}${1}${(@)^tmparr}")
+ suffixes=("${(@)^suffixes[@]}${(q)1}${(@)^tmparr}")
# We want the completion code to generate the most specific suffix
# for us, so we collect matching specifications that allow partial
@@ -142,7 +142,7 @@
# If we were given at least one more separator we make the completion
# code offer it by appending it as a autoremovable suffix.
-(( $# )) && autosuffix=(-qS "$1")
+(( $# )) && autosuffix=(-qS "${(q)1}")
# If we have collected matching specifications, we build an array
# from it that can be used as arguments to `compadd'.
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author