From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1163 invoked from network); 27 Mar 2002 11:10:59 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 27 Mar 2002 11:10:59 -0000 Received: (qmail 17894 invoked by alias); 27 Mar 2002 11:10:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16911 Received: (qmail 17880 invoked from network); 27 Mar 2002 11:10:48 -0000 X-VirusChecked: Checked Date: Wed, 27 Mar 2002 11:10:20 +0000 From: Oliver Kiddle To: zsh-workers@sunsite.dk Subject: adding the original string as a completion match Message-ID: <20020327111020.GA15630@logica.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.27i Sender: Oliver Kiddle I thought it would be useful to have the original string added as a possible completion in my _match based completion widget similar to how _approximate adds it. So the patch below is a cut'n'paste job from _approximate into _match which I won't commit unless someone says to. Thinking about it, the original match could be useful anywhere that it goes into menu completion. Would it be possible to have a completer a bit like _all_matches (and taking some of the same styles) to add the original string? I tend to get the original string by hitting undo and just like to see what the original string was so this completer might optionally just mention the string in a message. And another question, is there any way with _all_matches that I can get it to just insert all the matches and never list all the things which _complete came up with? Something like a tag-order but that doesn't work. Oliver --- _match Mon Apr 2 12:08:02 2001 +++ _match Wed Mar 27 08:18:38 2002 @@ -22,6 +22,8 @@ _old_match_string="$PREFIX$SUFFIX$HISTNO" +_tags matches original + zstyle -s ":completion:${curcontext}:" match-original orig zstyle -s ":completion:${curcontext}:" insert-unambiguous ins @@ -61,10 +63,19 @@ # ins=yes compstate[insert]="$ocsi" compstate[pattern_insert]="$ocspi" fi - [[ "$ins" = (true|yes|on|1) && - $#compstate[unambiguous] -ge ${#:-${PREFIX}${SUFFIX}} ]] && - compstate[pattern_insert]=unambiguous + if [[ "$ins" = (true|yes|on|1) && + $#compstate[unambiguous] -ge ${#:-${PREFIX}${SUFFIX}} ]] + then + compstate[pattern_insert]=unambiguous + elif _requested original && + { [[ compstate[nmatches] -gt 1 ]] || + zstyle -t ":completion:${curcontext}:" original }; then + local expl + + _description -V original expl original + compadd "$expl[@]" -U -Q - "$PREFIX$SUFFIX" + fi fi return ret -- This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.