Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bug in 'rm' completion
- X-seq: zsh-workers 27377
- From: Greg Klanderman <gak@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: bug in 'rm' completion
- Date: Mon, 09 Nov 2009 16:20:50 -0500
- In-reply-to: <m3639j4mcl.fsf@xxxxxxxxxxxxxx> (Greg Klanderman's message of "Mon, 09 Nov 2009 12:52:26 -0500")
- 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: <19191.43212.832827.724369@xxxxxxxxxxxxxxxxxx> <m38wef4qqs.fsf@xxxxxxxxxxxxxx> <091109092926.ZM26572@xxxxxxxxxxxxxxxxxxxxxx> <m3639j4mcl.fsf@xxxxxxxxxxxxxx>
- Reply-to: gak@xxxxxxxxxxxxxx
>>>>> On November 9, 2009 Greg Klanderman <gak@xxxxxxxxxxxxxx> wrote:
> What I think is needed is to
> generally remove the current word from incorporation into the ignore
> pattern, but I don't know how to do that. If I knew how to relate
> $CURRENT to an element of $line that would do it.
I think the patch below is the correct fix. I'm still not sure
whether it should be using $line or $words and I'm not certain on the
difference between two and three colons in the _arguments definition
('*::files:->file' vs '*:::files:->file') but in both cases I suspect
it doesn't actually matter.
Let me know what you think..
Greg
Index: Completion/Unix/Command/_rm
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_rm,v
retrieving revision 1.2
diff -u -r1.2 _rm
--- Completion/Unix/Command/_rm 23 Nov 2008 18:23:29 -0000 1.2
+++ Completion/Unix/Command/_rm 9 Nov 2009 21:07:52 -0000
@@ -5,7 +5,7 @@
'(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]'
'(-I --interactive)-i[prompt before every removal]'
'(-r -R --recursive)'{-r,-R,--recursive}'[remove directories and their contents recursively]'
- '*:files:->file'
+ '*::files:->file'
)
if _pick_variant gnu=gnu unix --help; then
opts+=(-S)
@@ -33,7 +33,8 @@
case $state in
(file)
declare -a ignored
- ignored=(${line//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+ ignored=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+ ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
_files -F ignored && ret=0
;;
esac
Messages sorted by:
Reverse Date,
Date,
Thread,
Author