patch 9.0.1635: error message is cleared when removing mode message

Problem:    Error message is cleared when removing mode message.
Solution:   Also reset flags when the message is further down.
diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim
index 0647afd..6db1746 100644
--- a/src/testdir/test_messages.vim
+++ b/src/testdir/test_messages.vim
@@ -347,7 +347,8 @@
       endfunction
       set showmode
       set cmdheight=1
-      call setline(1, ['one', 'two', 'three'])
+      call test_settime(1)
+      call setline(1, ['one', 'NoSuchFile', 'three'])
   END
   call writefile(lines, 'XmessageMode', 'D')
   let buf = RunVimInTerminal('-S XmessageMode', {'rows': 10})
@@ -361,6 +362,12 @@
   call TermWait(buf)
   call VerifyScreenDump(buf, 'Test_message_not_cleared_after_mode_2', {})
 
+  " removing the mode message used to also clear the error message
+  call term_sendkeys(buf, ":set cmdheight=2\<CR>")
+  call term_sendkeys(buf, '2GvEgf')
+  call TermWait(buf)
+  call VerifyScreenDump(buf, 'Test_message_not_cleared_after_mode_3', {})
+
   call StopVimInTerminal(buf)
 endfunc