changeset 16021:5417a7f802ff v8.1.1016

patch 8.1.1016: MS-Windows: No color in shell when using "!" in 'guioptions commit https://github.com/vim/vim/commit/049ca59236d5a981f23cf5dfe40f54536fe7cad2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 17 16:59:44 2019 +0100 patch 8.1.1016: MS-Windows: No color in shell when using "!" in 'guioptions Problem: MS-Windows: No color in shell when using "!" in 'guioptions. Solution: Don't stop termcap when using a terminal window for the shell. (vim-jp, closes #4117)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Mar 2019 17:00:13 +0100
parents 9c0e120c9fe3
children 284797c49db1
files src/ex_cmds.c src/version.c
diffstat 2 files changed, 25 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -1542,6 +1542,7 @@ do_shell(
 #endif
 #ifdef MSWIN
     int		winstart = FALSE;
+    int		keep_termcap = FALSE;
 #endif
 
     /*
@@ -1557,48 +1558,54 @@ do_shell(
 
 #ifdef MSWIN
     /*
-     * Check if ":!start" is used.
+     * Check if ":!start" is used.  This implies not stopping termcap mode.
      */
     if (cmd != NULL)
-	winstart = (STRNICMP(cmd, "start ", 6) == 0);
+	keep_termcap = winstart = (STRNICMP(cmd, "start ", 6) == 0);
+
+# if defined(FEAT_GUI) && defined(FEAT_TERMINAL)
+    // Don't stop termcap mode when using a terminal window for the shell.
+    if (gui.in_use && vim_strchr(p_go, GO_TERMINAL) != NULL)
+	keep_termcap = TRUE;
+# endif
 #endif
 
     /*
      * For autocommands we want to get the output on the current screen, to
      * avoid having to type return below.
      */
-    msg_putchar('\r');			/* put cursor at start of line */
+    msg_putchar('\r');			// put cursor at start of line
     if (!autocmd_busy)
     {
 #ifdef MSWIN
-	if (!winstart)
+	if (!keep_termcap)
 #endif
 	    stoptermcap();
     }
 #ifdef MSWIN
     if (!winstart)
 #endif
-	msg_putchar('\n');		/* may shift screen one line up */
-
-    /* warning message before calling the shell */
+	msg_putchar('\n');		// may shift screen one line up
+
+    // warning message before calling the shell
     if (p_warn && !autocmd_busy && msg_silent == 0)
 	FOR_ALL_BUFFERS(buf)
 	    if (bufIsChangedNotTerm(buf))
 	    {
 #ifdef FEAT_GUI_MSWIN
-		if (!winstart)
-		    starttermcap();	/* don't want a message box here */
+		if (!keep_termcap)
+		    starttermcap();	// don't want a message box here
 #endif
 		msg_puts(_("[No write since last change]\n"));
 #ifdef FEAT_GUI_MSWIN
-		if (!winstart)
+		if (!keep_termcap)
 		    stoptermcap();
 #endif
 		break;
 	    }
 
-    /* This windgoto is required for when the '\n' resulted in a "delete line
-     * 1" command to the terminal. */
+    // This windgoto is required for when the '\n' resulted in a "delete line
+    // 1" command to the terminal.
     if (!swapping_screen())
 	windgoto(msg_row, msg_col);
     cursor_on();
@@ -1632,7 +1639,7 @@ do_shell(
 #ifndef FEAT_GUI_MSWIN
 	if (cmd == NULL
 # ifdef MSWIN
-		|| (winstart && !need_wait_return)
+		|| (keep_termcap && !need_wait_return)
 # endif
 	   )
 	{
@@ -1659,9 +1666,9 @@ do_shell(
 #endif /* FEAT_GUI_MSWIN */
 
 #ifdef MSWIN
-	if (!winstart) /* if winstart==TRUE, never stopped termcap! */
-#endif
-	    starttermcap();	/* start termcap if not done by wait_return() */
+	if (!keep_termcap)	// if keep_termcap is TRUE didn't stop termcap
+#endif
+	    starttermcap();	// start termcap if not done by wait_return()
 
 	/*
 	 * In an Amiga window redrawing is caused by asking the window size.
--- a/src/version.c
+++ b/src/version.c
@@ -780,6 +780,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1016,
+/**/
     1015,
 /**/
     1014,