From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24509 invoked by alias); 7 Mar 2015 03:40:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34669 Received: (qmail 10510 invoked from network); 7 Mar 2015 03:40:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:message-id:date:from :mime-version:to:subject:content-type:content-transfer-encoding; s=smtpout; bh=Gs8SSscyZwuvHmEMPfjuOJtDNfM=; b=WWaZ8Yqahh0MzLUZ1 iqXXiFW7Pd0oaRxRcXNzDEMzvm11gY221AWPzFJLFWM258FT6j4p7AdLZLJwd+sX hmeK7m3nDEE3MZhIqanVmg0I1IwjBTpgH9VjXWIRa/L4O+bMphkY3Wdkld62QeM3 +0SXkQaUA5iLGZbAXZcAky3lN4= X-Sasl-enc: fizBCKSnBe3Qcmmvm9rULi5tGyMkjTj4EMcO3g8pbWf4 1425699611 Message-ID: <54FA731B.8050800@pobox.com> Date: Fri, 06 Mar 2015 22:40:11 -0500 From: Andrew Janke User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: zsh-workers@zsh.org Subject: FAQ title bar answer using chpwd() Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, ZSH workers, I have a question about an answer in the ZSH FAQ. Is this the right list to ask about it? http://zsh.sourceforge.net/FAQ/zshfaq03.html#l23 Answer 3.6 suggests using chpwd() to emit terminal control sequences to update the title bar for Apple's Terminal.app. This probably isn't the right place to do it, because cd's can happen inside functions, pipelines, and so on whose output is going to be captured for use elsewhere. The terminal control sequences will contaminate the captured output instead of going to the terminal. There's at least one place in the wild where this causes an issue, with Android development scripts: https://github.com/robbyrussell/oh-my-zsh/issues/3524 The prompt or other known user-interaction output points are probably the only safe place to emit terminal control sequences like this. So precmd() is probably a better choice than chpwd() for this. It seems like chpwd() should probably not be used to do anything that emits to stdout, in case it's being captured. Should the FAQ answer be updated to reflect this? Cheers, Andrew