diff src/ui.c @ 24194:9f64c420f280 v8.2.2638

patch 8.2.2638: cannot write a message to the terminal from the GUI Commit: https://github.com/vim/vim/commit/4c86830fc578bcb47a51cf0983da5388cdbfe6cc Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 22 16:19:45 2021 +0100 patch 8.2.2638: cannot write a message to the terminal from the GUI Problem: Cannot write a message to the terminal from the GUI. Solution: Add :echoconsole and use it in the test runner. (issue https://github.com/vim/vim/issues/7975)
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Mar 2021 16:30:04 +0100
parents 8dbebce07695
children 1040b294bfd3
line wrap: on
line diff
--- a/src/ui.c
+++ b/src/ui.c
@@ -18,10 +18,14 @@
 #include "vim.h"
 
     void
-ui_write(char_u *s, int len)
+ui_write(char_u *s, int len, int console UNUSED)
 {
 #ifdef FEAT_GUI
-    if (gui.in_use && !gui.dying && !gui.starting)
+    if (gui.in_use && !gui.dying && !gui.starting
+# ifndef NO_CONSOLE
+	    && !console
+# endif
+	    )
     {
 	gui_write(s, len);
 	if (p_wd)
@@ -33,7 +37,7 @@ ui_write(char_u *s, int len)
     // Don't output anything in silent mode ("ex -s") unless 'verbose' set
     if (!(silent_mode && p_verbose == 0))
     {
-#if !defined(MSWIN)
+# if !defined(MSWIN)
 	char_u	*tofree = NULL;
 
 	if (output_conv.vc_type != CONV_NONE)
@@ -43,9 +47,11 @@ ui_write(char_u *s, int len)
 	    if (tofree != NULL)
 		s = tofree;
 	}
-#endif
+# endif
 
 	mch_write(s, len);
+	if (console && s[len - 1] == '\n')
+	    fsync(1);
 
 # if !defined(MSWIN)
 	if (output_conv.vc_type != CONV_NONE)