long start_lnum = SOURCING_LNUM;
ga_init2(&ga, 1, 80);
-#ifdef HAS_MESSAGE_WINDOW
- if (eap->cmdidx == CMD_echowindow)
- start_echowindow();
-#endif
if (eap->skip)
++emsg_skip;
msg_sb_eol();
}
- if (eap->cmdidx == CMD_echomsg || eap->cmdidx == CMD_echowindow)
+ if (eap->cmdidx == CMD_echomsg)
{
msg_attr(ga.ga_data, echo_attr);
out_flush();
}
+ else if (eap->cmdidx == CMD_echowindow)
+ {
+#ifdef HAS_MESSAGE_WINDOW
+ start_echowindow();
+#endif
+ msg_attr(ga.ga_data, echo_attr);
+#ifdef HAS_MESSAGE_WINDOW
+ end_echowindow();
+#endif
+ }
else if (eap->cmdidx == CMD_echoconsole)
{
ui_write(ga.ga_data, (int)STRLEN(ga.ga_data), TRUE);
if (eap->skip)
--emsg_skip;
-#ifdef HAS_MESSAGE_WINDOW
- if (eap->cmdidx == CMD_echowindow)
- end_echowindow();
-#endif
set_nextcmd(eap, arg);
}
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