Skip to content

Commit

Permalink
Fix a bug in recent dirs completion
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonrichert committed Oct 5, 2021
1 parent 3d97f06 commit 6b7c37c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions functions/completion/_autocomplete.recent_paths
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
zmodload -F zsh/parameter p:functions

_autocomplete.recent_paths() {
(( compstate[nmatches] < 2 )) ||
return
(( compstate[nmatches] > 1 )) &&
return 1

private -aU dirs=()
private -i ret=1
Expand Down Expand Up @@ -49,11 +49,10 @@ _autocomplete.recent_paths() {

# Work around `setopt autonamedirs` by not assigning absolute paths to scalars.
while (( $#matches )); do
compadd "$expl[@]" -d displ -P "${${(D)matches[1]:h}%/}/" -fW "${${matches[1]:h}%/}/" \
-- "$matches[1]:t" &&
ret=0
displ=( "$displ[@]" )
matches=( "$matches[@]" )
(( $#displ[1] > 1 )) &&
compadd "$expl[@]" -d displ -P "${${(D)matches[1]:h}%/}/" -fW "${${matches[1]:h}%/}/" \
-- "$matches[1]:t" &&
ret=0
shift -- displ matches
done

Expand Down

0 comments on commit 6b7c37c

Please sign in to comment.