Skip to content

Commit

Permalink
fix(preexec): play nice with inline zsh scripts...
Browse files Browse the repository at this point in the history
v1.1.0 introduced a bug where running '[[ -n $var ]]' would error
  • Loading branch information
olets committed May 16, 2024
1 parent c0e70d9 commit b1ddc56
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zsh-window-title.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ __zsh-window-title:preexec() {
__zsh-window-title:debugger

local cmd=${1[(w)1]}
local -i is_prefixed=$ZSH_WINDOW_TITLE_COMMAND_PREFIXES[(Ie)$cmd] 2>/dev/null
local second_word=${1[(w)2]}

(( ZSH_WINDOW_TITLE_COMMAND_PREFIXES[(Ie)$cmd] )) && cmd+=" ${1[(w)2]}"
(( is_prefixed )) && \
[[ -n $second_word ]] && \
cmd+=" $second_word"

'builtin' 'echo' -ne "\033]0;$(__zsh-window-title:get_dir) - $cmd\007"
}
Expand Down

0 comments on commit b1ddc56

Please sign in to comment.