prompt is broken when the terminal is resized if the prompt string is randomly changed.

Env:

$ fish --version
fish, version 3.0.2
$ uname -a
Linux acm-manjaro 4.19.97-1-MANJARO #1 SMP Sat Jan 18 00:17:24 UTC 2020 x86_64 GNU/Linux
$ echo $TERM
xterm-256color

I reproduced in clean env(sh -c 'env -i TERM=$TERM HOME=$(mktemp -d) fish')

If I set as

$ function fish_prompt
    switch (random choice 1 2)
        case 1
            echo -e 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n>'
        case 2
            echo -e 'bbbbbbbbbbb\n>'
    end
end

and I resized window, I god an merged string of them as prompt like

bbbbbbbbbbbaaaaaaaaaaaaaaaaaa
>

GIF:
deepin-screen-recorder_konsole_20200124215608