Skip to content

Commit

Permalink
fix: prevent execution of the command in title.
Browse files Browse the repository at this point in the history
  • Loading branch information
arcnmx authored and trystan2k committed Dec 7, 2021
1 parent 8680956 commit 6e532a4
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions zsh-tab-title.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Set terminal window and tab/icon title
#
# usage: title short_tab_title [long_window_title]
# usage: title short_tab_title long_window_title
#
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
# Fully supports screen, hyper, iterm, and probably most modern xterm and rxvt
Expand All @@ -13,25 +13,24 @@ function title {

[[ "$EMACS" == *term* ]] && return

# if $2 is unset use $1 as default
# if it is set and empty, leave it as is
: "${2=$1}"
tabTitle="\$1"
termTitle="\$2"

if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" # set window name
print -Pn "\e]1;$1:q\a" # set tab name
print -Pn "\e]2;$termTitle:q\a" # set window name
print -Pn "\e]1;$tabTitle:q\a" # set tab name
elif [[ "$TERM_PROGRAM" == "Hyper" ]]; then
print -Pn "\e]1;$2:q\a" # set tab name
print -Pn "\e]2;$1:q\a" # set window name
print -Pn "\e]1;$termTitle:q\a" # set tab name
print -Pn "\e]2;$tabTitle:q\a" # set window name
else
case "$TERM" in
cygwin|xterm*|putty*|rxvt*|ansi|${~ZSH_TAB_TITLE_ADDITIONAL_TERMS})
print -Pn "\e]2;$2:q\a" # set window name
print -Pn "\e]1;$1:q\a" # set tab name
print -Pn "\e]2;$termTitle:q\a" # set window name
print -Pn "\e]1;$tabTitle:q\a" # set tab name
;;

screen*|tmux*)
print -Pn "\ek$1:q\e\\" # set screen hardstatus
print -Pn "\ek$tabTitle:q\e\\" # set screen hardstatus
;;
esac
fi
Expand Down

0 comments on commit 6e532a4

Please sign in to comment.