From d9e72bbb60a8172921f2b3ac47bdeccce18ccab4 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Fri, 8 Oct 1999 17:04:12 +0000 Subject: zsh-workers/8181 --- Completion/Base/_tilde | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Completion/Base') diff --git a/Completion/Base/_tilde b/Completion/Base/_tilde index 95d342538..06500d427 100644 --- a/Completion/Base/_tilde +++ b/Completion/Base/_tilde @@ -9,7 +9,7 @@ setopt localoptions extendedglob -local d s dirs list lines +local d s dirs list lines revlines i if [[ "$SUFFIX" = */* ]]; then ISUFFIX="/${SUFFIX#*/}$ISUFFIX" @@ -21,22 +21,23 @@ fi if [[ -prefix [-+] ]]; then lines=(${(f)"$(dirs -v)"}) + integer i if [[ ( -prefix - && ! -o pushdminus ) || ( -prefix + && -o pushdminus ) ]]; then - integer tot i - for (( i = 1, tot = $#lines-1; i <= $#lines; i++, tot-- )); do - lines[$i]="$tot -- ${lines[$i]##[0-9]#[ ]#}" + revlines=( $lines ) + for (( i = 1; i <= $#lines; i++ )); do + lines[$i]="$((i-1)) -- ${revlines[-$i]##[0-9]#[ ]#}" done else - for (( i = 1, tot = 0; i <= $#lines; i++, tot++ )); do - lines[$i]="$tot -- ${lines[$i]##[0-9]#[ ]#}" + for (( i = 1; i <= $#lines; i++ )); do + lines[$i]="$((i-1)) -- ${lines[$i]##[0-9]#[ ]#}" done fi list=(${lines%% *}) compset -P '[-+]' _description d 'directory stack' - compadd "$d[@]" -ld lines -Q - "$list[@]" + compadd "$d[@]" -V dirs -S/ -ld lines -Q - "$list[@]" else if (( $# )); then d=( "$@" ) -- cgit 1.4.1