Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] update _ps (with question)
- X-seq: zsh-workers 41645
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] update _ps (with question)
- Date: Wed, 06 Sep 2017 14:26:03 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1504700764; bh=dRXGCHNGQzfwBDcULxirIghIQPBJXBv2V+N6gZLJyts=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=tcAMEExS2Z0qK1i4pew1BiCKOywYPj7+vRVCKyhy6j5k1U+mLtgMCZukWHiwIpLkteVXrp7iQJgQkvy3IxEnp34qQ9GGcd7m90udqqQIertlwwOVdUHZr6/44pbSRiuhead4MwpCgHmwPArrSMYn9s+QeXJ3VArgdmBNBPuorK2OvzdBvPuu9hNunKQjrTUuslsYkioZVxKL6fy4JCnbThu/tBWEQqgFKuq2lkvo7g9BB6p7JTPtWDRE9TGDmFQ0FKQ6m1s4v+g/22NVsiFdJ1f8timkG7NDFhqMksG127Oq6RByjAPOeJ4Mmm20mINQuV2OdtciPAcpb/5B7JjeTA==
- In-reply-to: <68D6FE10-4636-4582-AC2A-1FB0852EAC28@kba.biglobe.ne.jp>
- 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: <68D6FE10-4636-4582-AC2A-1FB0852EAC28@kba.biglobe.ne.jp>
On 2 Sep, "Jun T." wrote:
>
> if [[ -z $pids ]]; then
> _pids && compstate[insert]=
> fi
>
> Why compstate[insert] need be reset here? If it is reset, then
> nothing is completed by 'ps <TAB><TAB>...'
You can remove it.
It is reset because _pids sets it (depending on insert-ids) to menu
and we've got BSD options mixed in so _pids setting it is not as
appropriate. I've just experimented with it a bit and it's a bit tricky.
_pids doesn't really have wider knowledge of what other matches there
might be (aside from $compstate[nmatches]) so it is hard to have it
adapt to that.
'ps <tab><tab>' gets me menu selection. What do you have insert-ids,
menu and tag-order set to for this context?
Following patch is a totally unrelated minor tweak for ps completion on
Solaris.
Oliver
--- Completion/Unix/Command/_ps 2017-09-06 11:48:08.927796173 +0200
+++ Completion/Unix/Command/_ps 2017-09-06 11:49:04.773755213 +0200
@@ -226,8 +226,9 @@
if [[ $OSTYPE = (*bsd*|darwin*|dragonfly*) ]]; then
compset -P - && pids=1
else
- _arguments -C -s $args '*:: :->rest' && ret=0
- [[ -z "$state" || $OSTYPE = solaris* ]] && return ret
+ [[ $OSTYPE = solaris* ]] || args+=( '*:: :->rest' )
+ _arguments -C -s $args && ret=0
+ [[ -z "$state" ]] && return ret
fi
_values -s '' -S ' ' 'options' $bsd && ret=0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author