]> git.phdru.name Git - dotfiles.git/blobdiff - admin/prog/bash_prompt
Feat(bash_prompt): Set default value for `$COLUMNS` to 80
[dotfiles.git] / admin / prog / bash_prompt
index 8c3a9fe29612c4827ae1d868d0cf819395d727eb..14543705585b52f6ed8d8de2f54a1d0cd7466c5c 100644 (file)
@@ -7,7 +7,7 @@ cgmem_which_prompt() {
 }
 
 # Cut directories to 20% of the terminal width; add space for 3 dots
-_DIR_LENGTH=`awk "END { print int(0.2 * $COLUMNS) }" </dev/null`
+_DIR_LENGTH=`awk "END { print int(0.2 * ${COLUMNS:-80}) }" </dev/null`
 _DIR_LENGTH_DOTS=`expr $_DIR_LENGTH + 3`
 
 short_curdir() {
@@ -115,7 +115,7 @@ set_prompts() {
             PS1="\033]0;${_COMMON_PROMPT}\007" # Set xterm title/icon
             case "$TERM" in
                screen*)
-                  PS1="\033P\033]0;${_COMMON_PROMPT}\007\033\\\\" # Set xterm title/icon under screen/tmux
+                  PS1="\033P${PS1}\033\\\\" # Set xterm title/icon under screen/tmux
                   if [ -z "$MC_SID" ]; then
                      PS1+="\033k${_COMMON_PROMPT}\033\\\\" # Set screen/tmux caption
                   fi