- apply_title_to_terminal $*
- # we're enforcing a new title from here on.
- unset PRIOR_TERMINAL_TITLE
- save_terminal_title
+ local title="$*"
+
+ if [ -z "$title" ]; then
+ if [ ! -z "$DEBUG_TERM_TITLE" ]; then
+ echo "terminal_titler: empty title: pushing current title again"
+ fi
+ peek_title_stack
+ title="$LAST_TITLE"
+ if [ -z "$title" ]; then
+ log_feisty_meow_event "terminal_titler: there was no saved title, so we're ignoring the save attempt."
+ return 1
+ fi
+ fi
+
+#hmmm: need a validation step here to remove bad chars that conflict with our title compression scheme.
+
+ # only slap a comma after the existing value if it wasn't empty.
+ if [ -z "$TERMINAL_TITLE_STACK" ]; then
+ export TERMINAL_TITLE_STACK="\"$title\""
+ else
+ export TERMINAL_TITLE_STACK="$TERMINAL_TITLE_STACK,\"$title\""
+ fi
+
+ if [ ! -z "$DEBUG_TERM_TITLE" ]; then
+ echo "terminal_titler: new terminal title stack is:"
+ echo "$TERMINAL_TITLE_STACK"
+ fi