robbyrussell/oh-my-zsh — Issue #890: termsupport.zsh: unwanted execution of commands; interpretation of %-tags
Author: tomterl
Created: 2012-01-31 09:57:34+00:00
State: open

termuspport.zsh will execute subcommands on the current commandline; the output will be garbled due to prompt expansion of %-tags in commands like date/printf.

Please apply the following patch:

--------------------------------------------------------------------------------

*** termsupport.zsh.orig	2012-01-31 10:49:57.503119973 +0100
--- termsupport.zsh	2012-01-31 10:50:55.043118110 +0100
***************
*** 24,31 ****
function omz_termsupport_preexec {
emulate -L zsh
setopt extended_glob
! local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
! title "$CMD" "%100>...>$2%<<"
}

autoload -U add-zsh-hook
--- 24,35 ----
function omz_termsupport_preexec {
emulate -L zsh
setopt extended_glob
! local CMD_1=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
! local CMD_2=${2//\$\(/\\\$(} # ')}
! CMD_1=${CMD_1//\%/%%}
! CMD_2=${CMD_2//\%/%%}
! #
! title "${CMD_1}" "%100>...>${CMD_2}%<<"
}

autoload -U add-zsh-hook

--------------------------------------------------------------------------------

It might be necessary to escape backticks also, but I don't use these...

kind regards,
Tom