Mercurial > vim
changeset 16984:d4ecdb8a4c58 v8.1.1492
patch 8.1.1492: MS-Windows: when "!" is in 'guioptions' ":!start" fails
commit https://github.com/vim/vim/commit/7c348bb5ad106cfa35dd45560c5ac5d3c8496c96
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 8 12:05:22 2019 +0200
patch 8.1.1492: MS-Windows: when "!" is in 'guioptions' ":!start" fails
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 08 Jun 2019 12:15:08 +0200 |
parents | 03d245d277fe |
children | 914898e347fe |
files | src/misc2.c src/os_win32.c src/version.c |
diffstat | 3 files changed, 24 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/misc2.c +++ b/src/misc2.c @@ -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 {
--- a/src/os_win32.c +++ b/src/os_win32.c @@ -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