Skip to content

Commit b6503ba

Browse files
committed
fix(cd): fix the pattern matching
This code appears to try to suffix "/" when the unique completion of a directory name does not end with "/". However, the test compares the completion with the quoted `"*/"`, which does not work as expected. If the generated directory name already ends with "/" (though it is unclear whether it may happen except for "/"), this code would result in double slashes such as "dir//". This double-quoted pattern is present from the beginning when this code was introduced in commit a1969bd. This patch removes the double quoting so that the directory name is correctly matched with the pattern `*/`.
1 parent 247ba7b commit b6503ba

File tree

1 file changed

+1
-1
lines changed
  • completions

1 file changed

+1
-1
lines changed

completions/cd

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ _comp_cmd_cd()
4747

4848
if ((${#COMPREPLY[@]} == 1)); then
4949
i=${COMPREPLY[0]}
50-
if [[ $i == "$cur" && $i != "*/" ]]; then
50+
if [[ $i == "$cur" && $i != */ ]]; then
5151
COMPREPLY[0]="${i}/"
5252
fi
5353
fi

0 commit comments

Comments
 (0)