Needed as precmd functions are not called when redrawing the prompt. As far as I can tell zsh stupidly has no hook that is called when the prompt is redrawn after a window resize or when a background job finishes.