shfm: Fix cd when dir starts with -

This commit is contained in:
Dylan Araps 2020-08-11 22:19:26 +03:00
parent fa04365aa2
commit 0868399d04
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 4 additions and 4 deletions

8
shfm
View File

@ -290,7 +290,7 @@ main() {
;;
l?|C2|"$esc") # ARROW RIGHT
if [ -d "$cur" ] && cd "$cur" >/dev/null 2>&1; then
if [ -d "$cur" ] && cd -- "$cur" >/dev/null 2>&1; then
set -- *
y=1 y2=1 cur=$1 ltype=
redraw "$@"
@ -349,7 +349,7 @@ main() {
'~/'*) ans=$HOME/${ans#"~/"}
esac
cd "${ans:="$0"}" >/dev/null 2>&1|| continue
cd -- "${ans:="$0"}" >/dev/null 2>&1|| continue
set -- *
y=1 y2=1 cur=$1
redraw "$@"
@ -357,7 +357,7 @@ main() {
/?)
prompt / r
set -- "$ans"*
set -- $ans*
case $1$# in
"$ans*1") set -- 'no results'
@ -369,7 +369,7 @@ main() {
;;
-?)
cd "$OLDPWD" >/dev/null 2>&1|| continue
cd -- "$OLDPWD" >/dev/null 2>&1|| continue
set -- *
y=1 y2=1 cur=$1
redraw "$@"