zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: _sep_parts
@ 2000-02-16 16:42 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-02-16 16:42 UTC (permalink / raw)
  To: zsh-workers


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@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

* PATCH: _sep_parts
@ 2000-02-15 21:58 Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2000-02-15 21:58 UTC (permalink / raw)
  To: Zsh hackers list

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.

Index: Completion/Core/_sep_parts
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/Completion/Core/_sep_parts,v
retrieving revision 1.5
diff -u -r1.5 _sep_parts
--- Completion/Core/_sep_parts	2000/02/11 19:07:59	1.5
+++ Completion/Core/_sep_parts	2000/02/15 18:47:37
@@ -23,7 +23,7 @@
 # Get the options.
 
 zparseopts -D -a opts \
-    'J:=group' 'V=:group' P: F: S: r: R: q 1 2 n 'X:=expl' 'M+:=match'
+    'J:=group' 'V:=group' P: F: S: r: R: q 1 2 n 'X:=expl' 'M+:=match'
 
 if (( $#match )); then
   match="${match[2]}"

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-02-16 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-16 16:42 PATCH: _sep_parts Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2000-02-15 21:58 Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).