mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 02:12:08 +08:00
Fix "." and ".." paths in cd completions
Previously if a directory called "a" was in $CDPATH, `cd ./a<TAB>` would complete from there even if it was invalid.
This commit is contained in:
parent
8eb9dac4bc
commit
d7c690b416
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user