mostly fixes, some improvements
[distro-setup] / brc
diff --git a/brc b/brc
index 82b635cfd67462fe137783c3c40ea0892379b01f..75a7393eb15c7301d19b22b6a5498fcb9d4b70a1 100644 (file)
--- a/brc
+++ b/brc
@@ -2581,18 +2581,22 @@ if [[ $- == *i* ]]; then
     _title_escape="\033]0;"
   fi
 
+  # make the titlebar be the last command and the current directory.
   settitle () {
-    # this makes it so we show the current command if
-    # one is running, otherwise, show nothing
 
-    if [[ $1 == prompt-command ]]; then
+
+    # These are some checks to help ensure we dont set the title at
+    # times that the debug trap is running other than the case we
+    # want. Some of them might not be needed.
+    if (( ${#FUNCNAME[@]} != 1 || ${#BASH_ARGC[@]} != 2 || $BASH_SUBSHELL != 0 )); then
       return 0
     fi
-    if (( ${#BASH_ARGC[@]} == 1 && BASH_SUBSHELL == 0 )); then
-      echo -ne "$_title_escape ${PWD/#$HOME/~} "
-      printf "%s" "$*"
-      echo -ne "\007"
+    if [[ $1 == prompt-command ]]; then
+      return 0
     fi
+    echo -ne "$_title_escape ${PWD/#$HOME/~} "
+    printf "%s" "$*"
+    echo -ne "\007"
   }
 
   # note, this wont work: