robbyrussell/oh-my-zsh — pull request #3426 by apjanke (2014-12-20 07:36:02+00:00)
Title: termsupport: Move DISABLE_AUTO_TITLE check to hooks

This moves the DISABLE_AUTO_TITLE check from title() itself to the precmd/preexec hook functions that call it. It also allows single-argument use by defaulting the long window title ($2) to the short icon title ($1).

I'd like to do this because it would allow the title() function to be used directly by the user or other callers. In my workflow, I like to set the terminal tab title manually, and had my own settitle() function set up to do that. The OMZ title() function is already out there in the global function namespace, so it makes more sense to do that.

This arrangement of the check in the hooks was discussed in https://github.com/robbyrussell/oh-my-zsh/pull/266 but dismissed as DRY/not needed for performance. But I think it's worth reconsidering: this isn't for performance, but an interface/functionality change that makes title() more useful.

Also reformatted the comments to match comments in other OMZ lib/*.zsh files.