From 7b08995d96c407e93b1d8e4a3c11fd74c85a75cc Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 16 Aug 2010 17:34:48 +0200 Subject: [PATCH] zsh/rc: Escape non printable characters when setting window titles. --- zsh/rc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zsh/rc b/zsh/rc index 1f218f7..df4d357 100644 --- a/zsh/rc +++ b/zsh/rc @@ -411,14 +411,16 @@ if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then window_reset= } - # Sets the window title. Works with screen, xterm and rxvt. + # Sets the window title. Works with screen, xterm and rxvt. (V) escapes + # all non-printable characters. Thanks to Mikachu in #zsh on Freenode + # (2010-08-07 17:09 CEST). if [[ $TERM == screen* ]]; then window_title() { - print -n "\ek$1\e\\" + print -n "\ek${(V)1}\e\\" } elif [[ $TERM == xterm* || $TERM == rxvt* ]]; then window_title() { - print -n "\e]2;$1\e\\" + print -n "\e]2;${(V)1}\e\\" } else # Fallback if another TERM is used. -- 2.44.2