Skip to content

Commit

Permalink
functions: fix title() to not match any $TERM
Browse files Browse the repository at this point in the history
On my linux virtual terminals, where TERM="linux", I was getting
annoying output that was messing up my prompt.

It turns out the title function was always matching on the elif
statement for xterm/rxvt no matter what and the linux vt doesn't know
what to do with the title special control sequence and thus was printing
out garbage.

Through experimentation I figured out that the || inside of the [[ ]]
did not work:

export TERM=linux
$ if [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then echo $TERM; fi
linux

$ if [[ $TERM =~ "^xterm" ]] || [[ $TERM == "rxvt" ]]; then echo $TERM; fi

Signed-off-by: Brandon Philips <brandon@ifup.org>

openSUSE running zsh 4.3.10
  • Loading branch information
philips committed Oct 9, 2010
1 parent 541da0c commit aab235f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/functions.zsh
Expand Up @@ -5,7 +5,7 @@ function title {
print -nR $'\033k'$1$'\033'\\\

print -nR $'\033]0;'$2$'\a'
elif [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then
elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]]; then
# Use this one instead for XTerms:
print -nR $'\033]0;'$*$'\a'
fi
Expand Down

0 comments on commit aab235f

Please sign in to comment.