From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: PATCH: Re: prefix-needed style in _popd
Date: Tue, 27 Mar 2001 14:21:13 +0200 (MET DST) [thread overview]
Message-ID: <200103271221.OAA14754@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: =?iso-8859-1?q?Oliver=20Kiddle?='s message of Tue, 27 Mar 2001 12:39:50 +0100 (BST)
Oliver Kiddle wrote:
> --- Sven Wischnowsky <wischnow@informatik.hu-berlin.de> 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
reply other threads:[~2001-03-27 12:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200103271221.OAA14754@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).