From b4c318d761a2f9589a2764cc6aa5094925b06783 Mon Sep 17 00:00:00 2001 From: d3m3t3r <46783027+d3m3t3r@users.noreply.github.com> Date: Tue, 26 Nov 2024 18:59:24 +0000 Subject: [PATCH] Support user prompt in fallback precmd emulation --- src/subshell/common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/subshell/common.c b/src/subshell/common.c index cb17129e9..8fdbaa30b 100644 --- a/src/subshell/common.c +++ b/src/subshell/common.c @@ -1152,18 +1152,19 @@ init_subshell_precmd (char *precmd, size_t buff_size) */ static const char *precmd_fallback = " " /* Useful if the shell supports HISTCONTROL=ignorespace like functionality */ + "MC_PS1_SAVED=\"$PS1\"; " /* Save custom PS1 */ "precmd() { " "if [ ! \"${PWD##$HOME}\" ]; then " "MC_PWD=\"~\"; " "else " "[ \"${PWD##$HOME/}\" = \"$PWD\" ] && MC_PWD=\"$PWD\" || MC_PWD=\"~/${PWD##$HOME/}\"; " "fi; " - "echo \"$USER@$(hostname -s):$MC_PWD\"; " + "echo \"${MC_PS1_SAVED:-$USER@$(hostname -s):$MC_PWD\\$ }\"; " "pwd>&%d; " "kill -STOP $$; " "}; " "PRECMD=precmd; " - "PS1='$($PRECMD)$ '\n"; + "PS1='$($PRECMD)'\n"; switch (mc_global.shell->type) {