mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Support user prompt in fallback precmd emulation
This commit is contained in:
parent
dad5c64f6b
commit
b4c318d761
@ -1152,18 +1152,19 @@ init_subshell_precmd (char *precmd, size_t buff_size)
|
|||||||
*/
|
*/
|
||||||
static const char *precmd_fallback =
|
static const char *precmd_fallback =
|
||||||
" " /* Useful if the shell supports HISTCONTROL=ignorespace like functionality */
|
" " /* Useful if the shell supports HISTCONTROL=ignorespace like functionality */
|
||||||
|
"MC_PS1_SAVED=\"$PS1\"; " /* Save custom PS1 */
|
||||||
"precmd() { "
|
"precmd() { "
|
||||||
"if [ ! \"${PWD##$HOME}\" ]; then "
|
"if [ ! \"${PWD##$HOME}\" ]; then "
|
||||||
"MC_PWD=\"~\"; "
|
"MC_PWD=\"~\"; "
|
||||||
"else "
|
"else "
|
||||||
"[ \"${PWD##$HOME/}\" = \"$PWD\" ] && MC_PWD=\"$PWD\" || MC_PWD=\"~/${PWD##$HOME/}\"; "
|
"[ \"${PWD##$HOME/}\" = \"$PWD\" ] && MC_PWD=\"$PWD\" || MC_PWD=\"~/${PWD##$HOME/}\"; "
|
||||||
"fi; "
|
"fi; "
|
||||||
"echo \"$USER@$(hostname -s):$MC_PWD\"; "
|
"echo \"${MC_PS1_SAVED:-$USER@$(hostname -s):$MC_PWD\\$ }\"; "
|
||||||
"pwd>&%d; "
|
"pwd>&%d; "
|
||||||
"kill -STOP $$; "
|
"kill -STOP $$; "
|
||||||
"}; "
|
"}; "
|
||||||
"PRECMD=precmd; "
|
"PRECMD=precmd; "
|
||||||
"PS1='$($PRECMD)$ '\n";
|
"PS1='$($PRECMD)'\n";
|
||||||
|
|
||||||
switch (mc_global.shell->type)
|
switch (mc_global.shell->type)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user