Permalink
Browse files

fix title setting bug in xterm and urxvt

Before this patch, commands containing %-signs set the title wrong
(urxvt and xterm) [1] and produce strange output in urxvt [2].

test for bug 1:
> sleep 10 && echo %
sets title to "sleep 10 && echo %<<"
> sleep 10 && echo %f
doesn't change the title at all

test for bug 2 (only urxvt):
> echo %f
39m%f
^^^^^----- output
  • Loading branch information...
1 parent 73f7770 commit 43bd46b780cdf60b318f452e40b893ae18e77c41 @markusscherer committed Oct 3, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/termsupport.zsh
View
2 lib/termsupport.zsh
@@ -27,7 +27,7 @@ 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%<<"
+ title "$CMD" "%100>...>${2:gs/%/%%}%<<"
}
autoload -U add-zsh-hook

0 comments on commit 43bd46b

Please sign in to comment.