zsh-workers
 help / color / mirror / code / Atom feed
From: Andrew Janke <janke@pobox.com>
To: zsh-workers@zsh.org
Subject: FAQ title bar answer using chpwd()
Date: Fri, 06 Mar 2015 22:40:11 -0500	[thread overview]
Message-ID: <54FA731B.8050800@pobox.com> (raw)

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


             reply	other threads:[~2015-03-07  3:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-07  3:40 Andrew Janke [this message]
2015-03-07  4:19 ` Daniel Shahaf
2015-03-07  7:33   ` Bart Schaefer
2015-03-07  7:20 ` Bart Schaefer
2015-03-13  0:39   ` Lawrence Velázquez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54FA731B.8050800@pobox.com \
    --to=janke@pobox.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).