Browse code

functions: fix title() to not match any $TERM

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

Brandon Philips authored on 09/10/2010 at 05:44:42
Showing 1 changed files
... ...
@@ -5,7 +5,7 @@ function title {
5 5
     print -nR $'\033k'$1$'\033'\\\
6 6
 
7 7
     print -nR $'\033]0;'$2$'\a'
8
-  elif [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then
8
+  elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]]; then
9 9
     # Use this one instead for XTerms:
10 10
     print -nR $'\033]0;'$*$'\a'
11 11
   fi