Repository: neovim
Issue: Assert failure when resizing after multiline messages and calling screenstring() in VimResized
Labels: ui,has:repro,bug-crash,events,messages

### Problem

Assert failure when resizing after multiline messages and calling screenstring() in VimResized

### Steps to reproduce

1. Run `nvim --clean`
2. Source the following file:
```vim
autocmd VimResized * call screenstring(1, 1)
echo "abc\ndef"
set lines=10
```
3. ``message.c:2429: void msg_scroll_flush(void): Assertion `row >= 0' failed.``
```
                Stack trace of thread 185633:
                #0  0x00007feaeb42b8ec n/a (libc.so.6 + 0x878ec)
                #1  0x00007feaeb3dcea8 raise (libc.so.6 + 0x38ea8)
                #2  0x00007feaeb3c653d abort (libc.so.6 + 0x2253d)
                #3  0x00007feaeb3c645c n/a (libc.so.6 + 0x2245c)
                #4  0x00007feaeb3d59f6 __assert_fail (libc.so.6 + 0x319f6)
                #5  0x000055f4643b3932 msg_scroll_flush (nvim + 0x1d7932)
                #6  0x000055f4642e19f6 screenchar_adjust (nvim + 0x1059f6)
                #7  0x000055f464303453 f_screenstring (nvim + 0x127453)
                #8  0x000055f4642f200f call_internal_func (nvim + 0x11600f)
                #9  0x000055f464310556 call_func (nvim + 0x134556)
                #10 0x000055f464310968 get_func_tv (nvim + 0x134968)
                #11 0x000055f46431472b ex_call (nvim + 0x13872b)
                #12 0x000055f46432c5a4 execute_cmd0 (nvim + 0x1505a4)
                #13 0x000055f46432e42a do_one_cmd (nvim + 0x15242a)
                #14 0x000055f46432f008 do_cmdline (nvim + 0x153008)
                #15 0x000055f46429d3d4 apply_autocmds_group (nvim + 0xc13d4)
                #16 0x000055f46429d883 apply_autocmds (nvim + 0xc1883)
                #17 0x000055f4642d1488 screen_resize (nvim + 0xf5488)
                #18 0x000055f4643e3c83 set_num_option (nvim + 0x207c83)
                #19 0x000055f4643e58a2 do_set_num (nvim + 0x2098a2)
                #20 0x000055f4643e5aa9 do_set_option_value (nvim + 0x209aa9)
                #21 0x000055f4643e5fe4 do_set_option (nvim + 0x209fe4)
                #22 0x000055f4643e60c9 do_set (nvim + 0x20a0c9)
                #23 0x000055f4643e6306 ex_set (nvim + 0x20a306)
                #24 0x000055f46432c5a4 execute_cmd0 (nvim + 0x1505a4)
                #25 0x000055f46432e42a do_one_cmd (nvim + 0x15242a)
                #26 0x000055f46432f008 do_cmdline (nvim + 0x153008)
                #27 0x000055f464438c9a do_source (nvim + 0x25cc9a)
                #28 0x000055f464439204 cmd_source (nvim + 0x25d204)
                #29 0x000055f464439247 ex_source (nvim + 0x25d247)
                #30 0x000055f46432c5a4 execute_cmd0 (nvim + 0x1505a4)
                #31 0x000055f46432e42a do_one_cmd (nvim + 0x15242a)
                #32 0x000055f46432f008 do_cmdline (nvim + 0x153008)
                #33 0x000055f4643d04b8 nv_colon (nvim + 0x1f44b8)
                #34 0x000055f4643cf323 normal_execute (nvim + 0x1f3323)
                #35 0x000055f464468f85 state_enter (nvim + 0x28cf85)
                #36 0x000055f4643c7993 normal_enter (nvim + 0x1eb993)
                #37 0x000055f464254c41 main (nvim + 0x78c41)
                #38 0x00007feaeb3c7790 n/a (libc.so.6 + 0x23790)
                #39 0x00007feaeb3c784a __libc_start_main (libc.so.6 + 0x2384a)
                #40 0x000055f464250045 _start (nvim + 0x74045)
                ELF object binary architecture: AMD x86-64
```

### Expected behavior

No assert failure

### Neovim version (nvim -v)

v0.9.0-dev-1357+g68d6ca794

### Vim (not Nvim) behaves the same?

No

### Operating system/version

Arch Linux

### Terminal name/version

kitty 0.27.1

### $TERM environment variable

xterm-kitty

### Installation

build from repo