patch 9.0.0356: :echowindow sets the in_echowindow flag too early

Problem:    :echowindow sets the in_echowindow flag too early.
Solution:   Set in_echowindow only when outputting the text. (Yasuhiro
            Matsumoto, closes #11033)
diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim
index 10af69c..07a4b22 100644
--- a/src/testdir/test_messages.vim
+++ b/src/testdir/test_messages.vim
@@ -420,5 +420,25 @@
   call delete('XtestEchowindow')
 endfunc
 
+" messages window should not be used while evaluating the :echowin argument
+func Test_echowin_eval()
+  CheckScreendump
+
+  let lines =<< trim END
+      func ShowMessage()
+        echo 123
+        return 'test'
+      endfunc
+      echowindow ShowMessage()
+  END
+  call writefile(lines, 'XtestEchowindow')
+  let buf = RunVimInTerminal('-S XtestEchowindow', #{rows: 8})
+  call VerifyScreenDump(buf, 'Test_echowin_eval', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XtestEchowindow')
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab