From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20587 invoked from network); 27 Mar 2001 12:21:25 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Mar 2001 12:21:25 -0000 Received: (qmail 28050 invoked by alias); 27 Mar 2001 12:21:14 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13789 Received: (qmail 28035 invoked from network); 27 Mar 2001 12:21:12 -0000 Date: Tue, 27 Mar 2001 14:21:13 +0200 (MET DST) Message-Id: <200103271221.OAA14754@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.dk In-reply-to: =?iso-8859-1?q?Oliver=20Kiddle?='s message of Tue, 27 Mar 2001 12:39:50 +0100 (BST) Subject: PATCH: Re: prefix-needed style in _popd Oliver Kiddle wrote: > --- Sven Wischnowsky wrote: > > > Bleah... I never liked that prefix-needed business. > > I just never liked prefix-needed false behaviour. Maybe only because I > was used to always requiring a prefix going back to all my old tcsh > completions. One character prefixes are not a lot to type and it is > nice to cut down the number of matches. Err... I meant that I prefer this, too, and don't like all the problems handling prefix-needed==false has caused. > ... > > > Removing the prefix-needed handling is of course the easiest thing > > (and give the behaviour I almost certainly would want and expect, > > too). For that completeness thing we would have to add every entry > > with `+' and `-'. > > Personally, I think completeness purely for its own sake is pointless > unless you enjoy implementing it. Can I suggest then that if anyone > feels that completeness here is important or that there is some other > behaviour they want (such as choosing + or -) that they say. Otherwise > we should just remove prefix-needed from _popd so that what is > effectively a bug is gone. And I didn't mean to say that I was planning to implement adding all directories with both prefixes. The patch below just comments out using the prefix-needed style in _popd. > If anyone does make any significant changes to _popd, can I suggest > that they consider looking at _tilde which could and possibly should > call _popd (especially if _popd is renamed _directory_stack). Currently > it repeats much of _popd. Ah, right, thanks for the reminder. Bye Sven Index: Completion/Base/_tilde =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/_tilde,v retrieving revision 1.5 diff -u -r1.5 _tilde --- Completion/Base/_tilde 2000/05/31 09:38:26 1.5 +++ Completion/Base/_tilde 2001/03/27 12:16:55 @@ -24,33 +24,7 @@ _requested named-directories expl 'named directory' \ compadd "$suf[@]" "$@" -k nameddirs - if _requested directory-stack && - { ! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed || - [[ "$PREFIX" = [-+]* || nm -eq compstate[nmatches] ]] }; then - if zstyle -T ":completion:${curcontext}:directory-stack" verbose; then - integer i + _requested directory-stack && _popd "$suf[@]" && ret=0 - lines=("${PWD}" "${dirstack[@]}") - - if [[ ( -prefix - && ! -o pushdminus ) || - ( -prefix + && -o pushdminus ) ]]; then - revlines=( $lines ) - for (( i = 1; i <= $#lines; i++ )); do - lines[$i]="$((i-1)) -- ${revlines[-$i]}" - done - else - for (( i = 1; i <= $#lines; i++ )); do - lines[$i]="$((i-1)) -- ${lines[$i]}" - done - fi - list=( ${PREFIX[1]}${^lines%% *} ) - disp=( -ld lines ) - else - list=( ${PREFIX[1]}{0..${#dirstack}} ) - disp=() - fi - _all_labels -V directory-stack expl 'directory stack' \ - compadd "$suf[@]" "$disp[@]" -Q -a list && ret=0 - fi (( ret )) || return 0 done Index: Completion/Builtins/_popd =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_popd,v retrieving revision 1.5 diff -u -r1.5 _popd --- Completion/Builtins/_popd 2000/10/06 13:01:53 1.5 +++ Completion/Builtins/_popd 2001/03/27 12:16:55 @@ -7,10 +7,20 @@ setopt localoptions nonomatch -local expl list lines revlines disp +local expl list lines revlines disp suf -! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed || - [[ $PREFIX = [-+]* ]] || return 1 +if [[ "$SUFFIX" = */* ]]; then + ISUFFIX="/${SUFFIX#*/}$ISUFFIX" + SUFFIX="${SUFFIX%%/*}" + suf=(-S '') +else + suf=(-qS/) +fi + +### we decided against this, for now... +#! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed || + +[[ $PREFIX = [-+]* ]] || return 1 if zstyle -T ":completion:${curcontext}:directory-stack" verbose; then # get the list of directories with their canonical number @@ -38,4 +48,4 @@ fi _wanted -V directory-stack expl 'directory stack' \ - compadd "$@" "$disp[@]" -Q -a list + compadd "$@" "$suf[@]" "$disp[@]" -Q -a list -- Sven Wischnowsky wischnow@informatik.hu-berlin.de