From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6318 invoked from network); 25 May 2001 16:38:38 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 May 2001 16:38:38 -0000 Received: (qmail 14789 invoked by alias); 25 May 2001 16:38:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14483 Received: (qmail 14776 invoked from network); 25 May 2001 16:38:05 -0000 From: "Bart Schaefer" Message-Id: <1010525163508.ZM14824@candle.brasslantern.com> Date: Fri, 25 May 2001 16:35:08 +0000 In-Reply-To: <1010525151112.ZM14441@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "Re: compctl -y problem." (May 25, 3:11pm) References: <1010525151112.ZM14441@candle.brasslantern.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: compctl -y problem. Cc: Cesar Crusius MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii (Part of this thread went to zsh-workers ... returning now to zsh-users with a workaround) On May 25, 3:11pm, Bart Schaefer wrote: } } I know Sven won't be thrilled about being asked to fix anything in the } old compctl code ... perhaps we should just remove the `-y' option, as } it's new since 3.0 anyway, and document the correct way to achieve the } same effect by using the new completion system (which, incidentally, I } don't know how to do ... `compadd -d' doesn't quite cut it). On further reading of the compadd doc, `compadd -ld ...' appears to be the thing to do, though it's a bit convoluted. autoload -U compinit compinit function _aecd { local change_descriptions reply # Force change_descriptions to be a one-element array change_descriptions=("$(aereport changes -unf | grep -v completed)") # The name "reply" is not special here, I just happened to use it reply=($(aereport changes -terse | grep -v completed | sed -e 's/ .*$//')) # Display the change_descriptions in place of the first completion compadd -ld change_descriptions $reply[1] # Add the rest of the completions, but don't display them in the list compadd -na 'reply[2,-1]' # Force the list to appear so the descriptions are visible compstate[list]='list force' } compdef _aecd aecd It does appear that "compadd -d" still produces a sub-optimal display in this case if there are any lines in $change_descriptions that have exactly $COLUMNS characters; but it properly returns the cursor to the right spot even so. I don't know what the output of `aereport changes` looks like, so it may be that there's a simpler solution. For example, if the same number of lines will be returned by `aereport changes -unf` and `... -terse`, this will work: function _aecd { local change_descriptions reply change_descriptions=(${(f)"$(aereport changes -unf | grep -v completed)"}) reply=($(aereport changes -terse | grep -v completed | sed -e 's/ .*$//')) compadd -ld change_descriptions -a reply compstate[list]='list force' } You may also wish to drop that compstate[list] assignment and instead use the force-list style to control it: zstyle ':completion:*:aecd' force-list always See the manual for more. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net