When use zsh instead of bash, shell become very annoying. Even if I do not edit the shell buffer, but changing its size, there will be extra lines generated in the buffer, which is not expected.

Here is a recipe to reproduce the bug. See attached for screenshots.

(1) Starting from emacs -Q.

  [1.png in attached]

(2) M-x shell. Here my default shell is zsh, and I also have oh-my-zsh installed.

  [2.png in attached]

You can see there are multi-line "leading info" (sorry for my poor English, I mean the characters on the left of the cursor before you enter a command in the shell, showing the username and the current directory; I don't know what it is called in English), but in bash there is only one line instead. I guess this is the key of the problem.

By the way, maybe there are different "schemes" or "styles" for zsh, for some of them there will be multi-line leading info.

(3) Repeat C-x 1, C-x 2, C-x 1, C-x 2, ...

  [3.png & 4.png in attached]

There will be more and more lines in the shell, which is unexpected, because you did not edit the buffer.