From d7c690b4162ddd25c4ef6177a9e88db283caf9fa Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 8 Apr 2016 15:03:49 +0200 Subject: Fix "." and ".." paths in cd completions Previously if a directory called "a" was in $CDPATH, `cd ./a` would complete from there even if it was invalid. --- share/functions/__fish_complete_cd.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/functions/__fish_complete_cd.fish b/share/functions/__fish_complete_cd.fish index cdbd02a7..3ba2ad9d 100644 --- a/share/functions/__fish_complete_cd.fish +++ b/share/functions/__fish_complete_cd.fish @@ -1,7 +1,7 @@ function __fish_complete_cd -d "Completions for the cd command" set -l token (commandline -ct) - # Absolute path - no descriptions and no CDPATH - if string match -q '/*' -- $token + # Absolute path or explicitly from the current directory - no descriptions and no CDPATH + if string match -qr '^\.?\.?/.*' -- $token for d in $token*/ # Check if it's accessible - the glob only matches directories [ -x $d ]; and printf "%s\n" $d -- cgit v1.2.3