Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: completion of glob qualifiers
- X-seq: zsh-workers 24588
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: completion of glob qualifiers
- Date: Sat, 23 Feb 2008 17:33:10 +0000
- In-reply-to: Message from Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> of "Fri, 22 Feb 2008 22:06:55 PST." <080222220655.ZM31839@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> On Feb 23, 12:04am, Peter Stephenson wrote:
> }
> } It works OK so far but it does raise various issues about related things
> } that might be got to work better. You might run across those.
>
> Yes, this is pretty cool. I suppose the things that might work better
> are e.g. completion of modifiers after !!: and $var: ?
Those need adding, but there is actually all sorts of syntax nastiness
if you try anything with metacharacters, even in places where they are
parsed properly in normal operation. Try "${(", for example.
> It'd also be nice if, for example, it would notice that the qualifier
> needs to be followed by a numeric value and wouldn't complete another
> qualifier the number was present, but that's a nit.
It's supposed to do that, and I'm not sure which one wasn't working,
although looking again I can see a few places I haven't handled
consistently.
Index: Completion/Zsh/Type/_globquals
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_globquals,v
retrieving revision 1.1
diff -u -r1.1 _globquals
--- Completion/Zsh/Type/_globquals 23 Feb 2008 00:10:25 -0000 1.1
+++ Completion/Zsh/Type/_globquals 23 Feb 2008 17:33:47 -0000
@@ -56,24 +56,18 @@
(d)
# complete/skip device
- if [[ -z $PREFIX ]]; then
- _message device ID
+ if ! compset -p '[[:digit:]]##'; then
+ _message "device ID"
return
fi
- # It's pointless trying to complete the device.
- # Simply assume it's done.
- compset -p '[[:digit:]]##'
;;
(l)
# complete/skip link count
- if [[ PREFIX = ([-+]|) ]]; then
- _message link count
+ if ! compset -P '([-+]|)[[:digit:]]##'; then
+ _message "link count"
return
fi
- # It's pointless trying to complete the link count.
- # Simply assume it's done.
- compset -P '([-+]|)[[:digit:]]##'
;;
(u)
@@ -162,9 +156,9 @@
# complete/skip range: check for closing bracket
if ! compset -P "(-|)[[:digit:]]##(,(-|)[[:digit:]]##|)]"; then
if compset -P "(-|)[[:digit:]]##,"; then
- _message end of range
+ _message "end of range"
else
- _message start of range
+ _message "start of range"
fi
return
fi
@@ -172,7 +166,7 @@
(:)
# complete modifiers and don't stop completing them
- _history_modifiers
+ _history_modifiers q
return
;;
esac
Index: Completion/Zsh/Type/_history_modifiers
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_history_modifiers,v
retrieving revision 1.1
diff -u -r1.1 _history_modifiers
--- Completion/Zsh/Type/_history_modifiers 23 Feb 2008 00:10:25 -0000 1.1
+++ Completion/Zsh/Type/_history_modifiers 23 Feb 2008 17:33:47 -0000
@@ -53,9 +53,10 @@
[[ -n $PREFIX ]] && return 1
list=("\::modifier")
- [[ $type = g ]] && list+=("):end of qualifiers")
+ [[ $type = q ]] && list+=("):end of qualifiers")
# strictly we want a normal suffix if end of qualifiers
_describe -t delimiters "delimiter" list -Q -S ''
+ return
else
list=(
"s:substitute string"
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author