mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 03:01:15 -03: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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user