]> granicus.if.org Git - vim/commitdiff
patch 8.1.1492: MS-Windows: when "!" is in 'guioptions' ":!start" fails v8.1.1492
authorBram Moolenaar <Bram@vim.org>
Sat, 8 Jun 2019 10:05:22 +0000 (12:05 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 8 Jun 2019 10:05:22 +0000 (12:05 +0200)
Problem:    MS-Windows: when "!" is in 'guioptions' ":!start" fails.
Solution:   Do not use a terminal window when the shell command begins with
            "!start". (Yasuhiro Matsumoto, closes #4504)

src/misc2.c
src/os_win32.c
src/version.c

index 2ac7f5e77cbc0d657d780ad79fc8185d48e92f0e..45070d7197a5394491dce4e551caa1916a759444 100644 (file)
@@ -3251,7 +3251,11 @@ call_shell(char_u *cmd, int opt)
        /* The external command may update a tags file, clear cached tags. */
        tag_freematch();
 
-       if (cmd == NULL || *p_sxq == NUL)
+       if (cmd == NULL || *p_sxq == NUL
+#if defined(FEAT_GUI_MSWIN) && defined(FEAT_TERMINAL)
+               || vim_strchr(p_go, GO_TERMINAL) != NULL
+#endif
+               )
            retval = mch_call_shell(cmd, opt);
        else
        {
index 60bf34131752058c394c67b92027801cd3c2d10e..1b961b22cf9634ca6cae8cdd723b5d86f4c7dc9d 100644 (file)
@@ -4640,20 +4640,30 @@ mch_call_shell(
     }
 #endif
 #if defined(FEAT_GUI) && defined(FEAT_TERMINAL)
-    /* TODO: make the terminal window work with input or output redirected. */
+    // TODO: make the terminal window work with input or output redirected.
     if (
 # ifdef VIMDLL
-       gui.in_use &&
+           gui.in_use &&
 # endif
-       vim_strchr(p_go, GO_TERMINAL) != NULL
+           vim_strchr(p_go, GO_TERMINAL) != NULL
         && (options & (SHELL_FILTER|SHELL_DOOUT|SHELL_WRITE|SHELL_READ)) == 0)
     {
-       /* Use a terminal window to run the command in. */
-       x = mch_call_shell_terminal(cmd, options);
+       char_u  *cmdbase = cmd;
+
+       // Skip a leading quote and (.
+       while (*cmdbase == '"' || *cmdbase == '(')
+           ++cmdbase;
+
+       // Check the command does not begin with "start "
+       if (STRNICMP(cmdbase, "start", 5) != 0 || !VIM_ISWHITE(cmdbase[5]))
+       {
+           // Use a terminal window to run the command in.
+           x = mch_call_shell_terminal(cmd, options);
 # ifdef FEAT_TITLE
-       resettitle();
+           resettitle();
 # endif
-       return x;
+           return x;
+       }
     }
 #endif
 
index 79d040037f3f4da53f9174991bade3ca5064cce1..d1ef98b55c208175d4f6cfc55104c827be7f38e3 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1492,
 /**/
     1491,
 /**/