]> git.phdru.name Git - dotfiles.git/commitdiff
Refactor(.shellrc): Test for `mc` down the stack
authorOleg Broytman <phd@phdru.name>
Sun, 25 Apr 2021 22:59:11 +0000 (01:59 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 25 Apr 2021 22:59:11 +0000 (01:59 +0300)
Midnight Commander prevents setting screen/tmux caption.

.shellrc
admin/prog/bash_prompt

index 7004054bbe9e184070a82a74e9a8489cb9bbcb37..62da7b79080928d80ddefddea6636d4f8b243fb4 100644 (file)
--- a/.shellrc
+++ b/.shellrc
@@ -44,7 +44,7 @@ if test -n "$KSH_VERSION" -o -n "$FCEDIT"; then
    j() { jobs; }
 fi
 
-if test -n "$BASH_VERSION" -a -z "$MC_SID"; then
+if test -n "$BASH_VERSION"; then
    if [ -r "$HOME"/admin/prog/bash_prompt ]; then
       . "$HOME"/admin/prog/bash_prompt
       set_prompts
@@ -76,23 +76,6 @@ include() {
 
 
 mc() {
-   if test -n "$BASH_VERSION"; then
-      MC_SAVE_OPS1="$OPS1"
-      if [ "`type -t short_curdir`" = function ]; then
-         OPS1="\`cgmem_which_prompt\`\u@\${HOSTNAME::5}:\`short_curdir\`"
-         if test -x /usr/bin/git >/dev/null 2>&1; then
-            #if [ "`type -t __git_ps1`" = function ]; then
-            #   OPS1+="\$(__git_ps1)"
-            #else
-               OPS1+="\$(prompt_git)"
-            #fi
-         fi
-         OPS1+=" \$SHLVL\\$ "
-      else
-         OPS1="\u@\h:\W \$SHLVL\\$ "
-      fi
-   fi
-
    if [ -n "$SLOWTERM" ]; then
       MC_SLOW="--slow"
    fi
@@ -149,8 +132,7 @@ mc() {
       rc=1
    fi
 
-   [ -n "$MC_SAVE_OPS1" ] && OPS1="$MC_SAVE_OPS1"
-   unset MC_FOUND MC_PWD_FILE MC_SAVE_OPS1 MC_SLOW MC_TMP_DIR MC_XTERM
+   unset MC_FOUND MC_PWD_FILE MC_SLOW MC_TMP_DIR MC_XTERM
 
    return $rc
 }
index 22445711837d5fe68abde83ee598d3e32936687f..f18379d852899f3ae2ef512bf739a230bee5608c 100644 (file)
@@ -112,7 +112,9 @@ set_prompts() {
             case "$TERM" in
                screen*)
                   OPS1="\[\033P\033]0;${_COMMON_PROMPT}\007\033\\\\\]" # Set xterm title/icon under screen/tmux
-                  OPS1+="\[\033k${_COMMON_PROMPT}\033\\\\\]" # Set screen/tmux caption
+                  if [ -z "$MC_SID" ]; then
+                     OPS1+="\[\033k${_COMMON_PROMPT}\033\\\\\]" # Set screen/tmux caption
+                  fi
                ;;
             esac
          ;;