Many terminals reflow text when the window is resized. When the height of the prompt changes as a result of this reflowing, ZSH draws the updated prompt on the wrong line. This can lead to some parts of the prompt not being erased, or to the disappearance of lines prior to the prompt. There are many ways to reproduce this issue. Here are a couple. Both require terminals that reflow text when the window is resized. 1. Run `zsh -df`, hit a few times, then type `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` (don't hit ). OR 2. Run `PROMPT="${(pl.$COLUMNS..-.)}%f"$'\n> ' zsh -df` and hit a few times. Now try resizing the terminal window back and forth causing lines to wrap and unwrap. Terminal content before the last prompt will be erased one line at a time. This patch cannot handle the case when the terminal window is being resized while the first prompt line is outside the terminal window. The content of the viewport will be correct but scrolling the terminal window up will reveal some mess up there. ZSH before this patch also fails in this case although it creates a different mess. The change is conservative. The new code triggers only on window resize and not, for example, on redisplay. This reduces the chance that it'll break something that isn't currently broken. I've tested this code only on GNOME Terminal. Before I go testing on a dozen different terminals I'd like to get some feedback. Anything I'm missing? Anything tricky to look out for? The patch is attached to the email. You can also see it in https://github.com/zsh-users/zsh/compare/master...romkatv:fix-winchanged. Roman.