From b43f9ef3baee676739d2eaf21909d0d00041e38f Mon Sep 17 00:00:00 2001 From: Joseph Irwin Date: Mon, 2 Apr 2012 20:46:59 +0900 Subject: [PATCH] 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. --- terminal.zsh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/terminal.zsh b/terminal.zsh index 7679d832..8d8273c1 100644 --- a/terminal.zsh +++ b/terminal.zsh @@ -78,15 +78,17 @@ autoload -Uz add-zsh-hook # Sets the tab and window titles before the prompt is displayed. function set-title-precmd { - if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && zstyle -t ':omz:terminal' auto-title; then - set-window-title "${(%):-%~}" - for kind in tab screen; do - # Left-truncate the current working directory to 15 characters. - set-${kind}-title "${(%):-%15<...<%~%<<}" - done - else - # Set Apple Terminal current working directory. - printf '\e]7;%s\a' "file://$HOST${PWD// /%20}" + if zstyle -t ':omz:terminal' auto-title; then + if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]]; then + set-window-title "${(%):-%~}" + for kind in tab screen; do + # Left-truncate the current working directory to 15 characters. + set-${kind}-title "${(%):-%15<...<%~%<<}" + done + else + # Set Apple Terminal current working directory. + printf '\e]7;%s\a' "file://$HOST${PWD// /%20}" + fi fi } add-zsh-hook precmd set-title-precmd