Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: /usr/bin/printf
- X-seq: zsh-users 13841
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: /usr/bin/printf
- Date: Fri, 13 Feb 2009 11:45:30 +0100
- 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:content-type :content-transfer-encoding; bh=UY/eTvf6L1FEOA/GCTrdvR5ENUsVIkq1+2dshEeswtg=; b=B91gD0/Ua9VtbFsvt357n98Y+KjL9HAsjKVGTTRbpMLz2EPQ4rkanYD3nLgrab9Mjz wHwVZmUrCeOdd5kG1TfJMAE283NvRmiDjIWVBAlzYU8thbGSvEYCsttxoy3sUSOWJ7qH AVfjfoaH3CVrtvdhL5zQhpupUuDgZSNfNegnU=
- 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 :content-type:content-transfer-encoding; b=sfgu2n/sLXbj+77vA4QjVggntztG6Xz6oEodJMML8BFbVEEph9xlhApXfQBy21OsXn u7bFguFhvXEGo4MyVHwSjBCfjZHTRhOWX2SppXPHewlK+lOAKer3b8DuIUVG8nbTJ+zx wP/0cHQwKnbbVNGiuEQUf+YR3TgXW7bYe5Bhs=
- In-reply-to: <237967ef0902130240r375361d3r247dccf72b81d443@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <4994CFCF.2090408@xxxxxxxxxx> <237967ef0902121751k37dd810co312238682d9b60f0@xxxxxxxxxxxxxx> <4994E32E.2050508@xxxxxxxxxx> <090212192523.ZM11726@xxxxxxxxxxxxxxxxxxxxxx> <dbfc82860902121940x7270f12dt13f10d706c9e65fb@xxxxxxxxxxxxxx> <4994F382.5090205@xxxxxxxxxx> <237967ef0902130240r375361d3r247dccf72b81d443@xxxxxxxxxxxxxx>
2009/2/13 Mikael Magnusson <mikachu@xxxxxxxxx>:
> The \a is the endcode for the title setting command, it is just an
> arbitrary value really, as much as \e and ] are. That said, I don't
> think this command works if you put literal \a on your command line.
> This is what I use:
>
> #for changing a *term title
> function ct() {
> local MATCH
> if [[ "$1" = "-e" ]]; then
> #nulls terminate the string when printed, so change them
> printf '\e]0;%s\007' ${${${2//$'\x00'/\^@}//
> /\\n}//(#m)[$'\x00'-$'\x1f']/$'\x16'$MATCH}
Well I remember what this part does now, it puts a literal ^V before
every byte between 0 and 0x1f, which is a trick that probably only
works in rxvt-unicode, I have this commented out below which seems to
work more generally:
# #(q) instead of (V) is also an option
printf '\e]0;%s\007' ${${2//
/\\n}//(#m)[$'\x00'-$'\x1f']/${(V)MATCH}}
> elif [[ "$1" = "-t" ]]; then
> pts="$2"
> ct -e "$3" > /dev/pts/$pts
> else
> ct -e "$*"
> fi
> }
>
> To be honest, I can't say off hand what all those parts do, they're
> sort of stacked on top of eachother until it stopped letting anything
> through.
>
> My actual preexec() calls it like this:
> if [ "$#1" -gt 512 ];then 1=${1[1,512]}; fi
> ct -e "$TTY:t [$1] {`print -P "%100<...<%~%<<"`} `strftime "%x %T"
> $EPOCHSECONDS`"
>
> --
> Mikael Magnusson
>
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author