Merge branch 'screen_plugin_bugfix_feature' of github.com:scosu/oh-my-zsh

Fixed the conflict and tested for the newest version. Looks like it works correctly. Refs robbyrussell/oh-my-zsh#1491 and will try the pull request

Conflicts:
	lib/termsupport.zsh
This commit is contained in:
JJ Merelo 2015-10-21 13:59:58 +02:00
commit 901d0c80ff
2 changed files with 35 additions and 10 deletions

View file

@ -6,6 +6,14 @@
# Fully supports screen, iterm, and probably most modern xterm and rxvt
# (In screen, only short_tab_title is used)
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
ZSH_SCREEN_PLUGIN_ACTIVE=false
for i in $plugins; do
if [[ "$i" == "screen" ]]; then
ZSH_SCREEN_PLUGIN_ACTIVE=true
fi
done
function title {
emulate -L zsh
setopt prompt_subst
@ -17,8 +25,13 @@ function title {
: ${2=$1}
if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
# do not set the screen hardstatus, if screen plugin is active
if [[ "$ZSH_SCREEN_PLUGIN_ACTIVE" != "true" ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
fi
elif [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" #set window name
print -Pn "\e]1;$1:q\a" #set icon (=tab) name
fi