From f57daa1678f3af2053efe6e149faf527d7a6ca98 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 19 Jan 2020 15:29:44 +0300 Subject: [PATCH] Ticket #3355: mc-wrapper: don't cd to the same directory. This would make a subsequent "cd -" more convenient. If you don't alter the directory in mc, after exiting a "cd -" does nothing, whereas it could take you to the actual previous directory. Thanks Egmont Koblinger for the initial patch. Signed-off-by: Andrew Borodin --- contrib/mc-wrapper.csh.in | 2 +- contrib/mc-wrapper.sh.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/mc-wrapper.csh.in b/contrib/mc-wrapper.csh.in index 45ef98116..1eca8e7b7 100644 --- a/contrib/mc-wrapper.csh.in +++ b/contrib/mc-wrapper.csh.in @@ -10,7 +10,7 @@ endif if (-r "$MC_PWD_FILE") then setenv MC_PWD "`cat '$MC_PWD_FILE'`" - if ( -d "$MC_PWD" ) then + if ("$MC_PWD" != "$cwd" && -d "$MC_PWD") then cd "$MC_PWD" endif unsetenv MC_PWD diff --git a/contrib/mc-wrapper.sh.in b/contrib/mc-wrapper.sh.in index 2791d9e97..3905be480 100644 --- a/contrib/mc-wrapper.sh.in +++ b/contrib/mc-wrapper.sh.in @@ -4,7 +4,7 @@ MC_PWD_FILE="${TMPDIR-/tmp}/mc-$MC_USER/mc.pwd.$$" if test -r "$MC_PWD_FILE"; then MC_PWD="`cat "$MC_PWD_FILE"`" - if test -n "$MC_PWD" && test -d "$MC_PWD"; then + if test -n "$MC_PWD" && test "$MC_PWD" != "$PWD" && test -d "$MC_PWD"; then cd "$MC_PWD" fi unset MC_PWD