Bad prompt on resize behavior
What Operating System(s) are you seeing this problem on?
Windows, macOS
Which Wayland compositor or X11 Window manager(s) are you using?
On Windows and MacOS, running WezTerm natively. On Windows, showing behavior in WSL (Windows Subsytem for Linux). Windows also runs X410 server that was used to show Terminator ran from WSL that was recorded for comparison.
WezTerm version
20230119-205418-9a76a540
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
The prompt redraw behavior in WezTerm produces lot of output, spamming scrollback buffer. I have recorded videos as this is most easily explained visually. Expected Behavior section then shows behavior in iTerm2 and Terminator.
Using ZSH: https://user-images.githubusercontent.com/1514221/213687735-33221eb5-5c79-4a43-8ac9-ba9022c3727b.mp4
Using simple Bash: https://user-images.githubusercontent.com/1514221/213688043-9ce953f0-d659-4534-bb60-187a6b00f6ec.mp4
To Reproduce
- The worst output is produced when using Oh-My-Zsh with Powerline10k theme (see below for configuration).
- There are glitches even when using simple Bash prompt without bells and whistles
The issue appears when terminal's pane width changes, by resizing pane or when TogglePaneZoomState is triggered.
Configuration
no config - the issue is reproducible running wezterm -n.
Expected Behavior
iTerm2: https://user-images.githubusercontent.com/1514221/213687607-68285ce9-4a73-43dd-ba9b-bb5c3f176d16.mp4
Terminator: https://user-images.githubusercontent.com/1514221/213687426-251bcf2a-ad3a-4b78-84f8-19730677825e.mp4
Notice that when pane is expanded in iTerm2, the prompt always simply expands.
Compare that with WezTerm above where in the beginning this seems to work, but later when there's some output it reprints prompt on new line even when expanded. Other terminals also never reprint the Transient Input line (starting with ❯), while this can be seen in WezTerm scrollback buffer.

Also, toggling pane-zoom in iTerm2 produces at most one extra dotted line that's not very disturbing:
Compare that with WezTerm that may end up looking like this:

Research
I've tried to find any reports of this before, at most I found this isssue 1491 that reported rather the native window jumping around, but you can see similarly gobbled scrollback in the user's videos where he seems to be using similar setup to mine.
I've also found this issue in Powerline10k repo - it seems WezTerm is not the only Terminal suffering from this. But knowing iTerm2 and even Terminator can handle the resizes better, there is likely something that can be done to solve it or minimize the impact. There is an interesting bit towards end of discussion, that may be taken out of context though:
The proper solution is to use a terminal that reflows everything except prompt. Kitty did this first, and then I implemented the same thing in zsh4humans.
Does this give you any pointers? Later I also found this section in the long P10K REAMDE.
Logs
No response
Anything else?
Additional information regarding setup: ZSH version: 5.8 (x86_64-ubuntu-linux-gnu) Oh-My-Zsh: f1a80006 (Jan 19th 2023) Powerline10k Theme: 21e89cb (Jan 19th 2023) configured to use Transient Prompt and two-line prompt.
Bash version: 5.0.16(1)
Bash prompt: PS1="\[\e]0;@\h: \w\a\]\[\033[01;32m\]@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$"
I'm only occasionally resizing the panes (though with current behavior even that is quite detrimental), but I'm very often toggling pane-zoom, for example executing command in normal size and toggling zoom to inspect large volumes of output afterwards. Having lot of empty space in scrollback means I always have to scroll-up a lot.
Source: wezterm/wezterm