Skip to content

Commit

Permalink
Support user prompt in fallback precmd emulation
Browse files Browse the repository at this point in the history
  • Loading branch information
d3m3t3r authored and zyv committed Jan 12, 2025
1 parent dcc71b5 commit 9d4bbe5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/subshell/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1153,18 +1153,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)
{
Expand Down

0 comments on commit 9d4bbe5

Please sign in to comment.