1
0
Fork 0

Fix condition in set-title-precmd

Fix the if condition inside set-title-precmd to not do anything if
':omz:terminal' autotitle is not true. There is a bug in the original
version where if the user sets autotitle to false the else condition is
automatically executed. This causes OSX escape commands to be printed to
the terminal on non-OSX systems.
pull/83/head
Joseph Irwin 13 years ago
parent 33b42e7398
commit b43f9ef3ba

@ -78,15 +78,17 @@ autoload -Uz add-zsh-hook
# Sets the tab and window titles before the prompt is displayed. # Sets the tab and window titles before the prompt is displayed.
function set-title-precmd { function set-title-precmd {
if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && zstyle -t ':omz:terminal' auto-title; then if zstyle -t ':omz:terminal' auto-title; then
set-window-title "${(%):-%~}" if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]]; then
for kind in tab screen; do set-window-title "${(%):-%~}"
# Left-truncate the current working directory to 15 characters. for kind in tab screen; do
set-${kind}-title "${(%):-%15<...<%~%<<}" # Left-truncate the current working directory to 15 characters.
done set-${kind}-title "${(%):-%15<...<%~%<<}"
else done
# Set Apple Terminal current working directory. else
printf '\e]7;%s\a' "file://$HOST${PWD// /%20}" # Set Apple Terminal current working directory.
printf '\e]7;%s\a' "file://$HOST${PWD// /%20}"
fi
fi fi
} }
add-zsh-hook precmd set-title-precmd add-zsh-hook precmd set-title-precmd

Loading…
Cancel
Save