mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 04:58:57 +00: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 changed files with 2 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
function __fish_complete_cd -d "Completions for the cd command"
|
function __fish_complete_cd -d "Completions for the cd command"
|
||||||
set -l token (commandline -ct)
|
set -l token (commandline -ct)
|
||||||
# Absolute path - no descriptions and no CDPATH
|
# Absolute path or explicitly from the current directory - no descriptions and no CDPATH
|
||||||
if string match -q '/*' -- $token
|
if string match -qr '^\.?\.?/.*' -- $token
|
||||||
for d in $token*/
|
for d in $token*/
|
||||||
# Check if it's accessible - the glob only matches directories
|
# Check if it's accessible - the glob only matches directories
|
||||||
[ -x $d ]; and printf "%s\n" $d
|
[ -x $d ]; and printf "%s\n" $d
|
||||||
|
|
Loading…
Reference in a new issue