Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: preexec and multi-line command.
- X-seq: zsh-users 14846
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Piotr Karbowski <jabberuser@xxxxxxxxx>
- Subject: Re: preexec and multi-line command.
- Date: Sat, 20 Feb 2010 20:51:30 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=rVMR7f9GLYZfdnN+W/xMNJ3Zq04db349VcmrlEKpIJE=; b=w+8ITLadI15lcTJ7pULKTO4SdmFfeMoYTbiez1GlbHmPwlBjgvech4iDCi/b8vSHg9 7l1uEKrNDebw5GyRl9KMD84p+FOzw9JwKcBft1xPhR9x79F9dUwMCzQvUs7PSvL2Bj6R /P36G4QIbZdB0S9rntWgBQnUvVCGKZh/l8G1g=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=HdbdrH8kPyPIdNSDHSSKly2YFGzfxji2mXjCbIpBcOuEyvroyJ+wEjQA45gVYkFoHH q77I7enyVwBI3A3XOr82DdHpW3gjl6HiJIJZag7eb/aRqr0qvjUcqm80ow+RmYn6jwj9 HLDIVtjZYoAIKNhatxAUX2j5MLwcvC+/vtJuQ=
- In-reply-to: <6910cba01002201120v65fc6904j758d41de17839b86@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <6910cba01002201120v65fc6904j758d41de17839b86@xxxxxxxxxxxxxx>
On 20 February 2010 20:20, Piotr Karbowski <jabberuser@xxxxxxxxx> wrote:
> Hi there!
>
> I have starge problem after I added preexec function to my zshrc to
> add in terminal TITLE what is running inside.
>
> ## cut here
> case $TERM in
> rxvt*|xterm|nxterm|gnome|screen)
> precmd () {print -Pn "\e]0;%n@%m: %~\a"}
> preexec () { print -Pn "\e]0;$1 [%n@%m: %~]\a"}
> ;;
> esac
> ## cut here
>
> Issue is that when I doing something multiline, I got:
>
> ## cut here
> slashbeast@ragnarok ~ % echo 1\
> slashbeast@ragnarok ~ > 2\
> slashbeast@ragnarok ~ > 3\
> slashbeast@ragnarok ~ >
>
> 2
> 3
> [slashbeast@ragnarok: ~]123
> slashbeast@ragnarok ~ %
> ## cut here
>
> How can I fix it?
You need to quote $1 properly, how to do that depends on your
terminal. I use this:
if [[ $TERM = rxvt-unicode ]]; then
printf '\0\e:\e]0;%s\007' ${${${1//$'\x00'/\^@}//
/\\n}//(#m)[$'\x00'-$'\x1f']/$'\x16'$MATCH}
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author