From 98b33d7b6b166b0ead2d7006df26a5789300dacc Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 9 Oct 2015 20:02:28 +0200 Subject: [PATCH] Fix pushd completions in the -n case --- share/completions/pushd.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/completions/pushd.fish b/share/completions/pushd.fish index 5d9519fc2..d38dc298c 100644 --- a/share/completions/pushd.fish +++ b/share/completions/pushd.fish @@ -10,8 +10,9 @@ end function __fish_complete_pushd_minus if count $dirstack > /dev/null # print each member of the stack, replace $HOME with ~ + # Negative arguments are expected to start at "-0" for i in (seq (count $dirstack) -1 1) - printf "-%s\t%s\n" $i "Rotate to "(string replace -r "^$HOME" "~" -- $dirstack[$i]) + printf "%s\t%s\n" -(math $i - 1) "Rotate to "(string replace -r "^$HOME" "~" -- $dirstack[(math -$i)]) end end end