Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completions issues



On Sat, Jul 13, 2002 at 21:20:37 +0000, Bart Schaefer wrote:

> } And question: how to make it without perl?
> 
>     smsas=( ${(f)$(smsaddr -l)} )

Here is the first trap - ${(f)... will change double tab to space, so
smsas would contain 'alias number alias number...' instead of
'alias<tab><tab>number alias<tab><tab>number...'...

>     smsas=( ${smsas/		/:}

...and this won't work.

> 	    ${smsas/(#s)(#b)(*)		(*)(#e)/$match[2]:$match[1]} )
>     smsas=( ${(M)smsas:#$PREFIX*} )
> 
> I don't think you even need that last smsas= that matches against $PREFIX,
> as the completion internals should take care of filtering the possible
> matches generated by _sms_aliases against the actual input on the line.

Completion filters possibilities by matchers, not their descriptions. In
my case matcher and description must be dynamically chosen on the
strength of prefix. As in other post:

gotar:~: smsaddr -l [tab]
SMS alias
6bone    -- 509xxx
admol    -- 602xxx

here admol is to be completed, 602xxx is description, but in:

gotar:~: smsaddr -l 6[tab]
SMS alias
6bone    -- 509xxx
602xxx   -- admol

602xxx is to be completed (prefix '6') and admol is it's description.

-- 
GoTaR <gotar@xxxxxxxxxxxxx>
PLD stuff at http://mops.uci.agh.edu.pl/~gotar/



Messages sorted by: Reverse Date, Date, Thread, Author