Skip to content

Commit 7c348bb

Browse files
committed
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)
1 parent 6064073 commit 7c348bb

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

src/misc2.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3251,7 +3251,11 @@ call_shell(char_u *cmd, int opt)
32513251
/* The external command may update a tags file, clear cached tags. */
32523252
tag_freematch();
32533253

3254-
if (cmd == NULL || *p_sxq == NUL)
3254+
if (cmd == NULL || *p_sxq == NUL
3255+
#if defined(FEAT_GUI_MSWIN) && defined(FEAT_TERMINAL)
3256+
|| vim_strchr(p_go, GO_TERMINAL) != NULL
3257+
#endif
3258+
)
32553259
retval = mch_call_shell(cmd, opt);
32563260
else
32573261
{

src/os_win32.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4640,20 +4640,30 @@ mch_call_shell(
46404640
}
46414641
#endif
46424642
#if defined(FEAT_GUI) && defined(FEAT_TERMINAL)
4643-
/* TODO: make the terminal window work with input or output redirected. */
4643+
// TODO: make the terminal window work with input or output redirected.
46444644
if (
46454645
# ifdef VIMDLL
4646-
gui.in_use &&
4646+
gui.in_use &&
46474647
# endif
4648-
vim_strchr(p_go, GO_TERMINAL) != NULL
4648+
vim_strchr(p_go, GO_TERMINAL) != NULL
46494649
&& (options & (SHELL_FILTER|SHELL_DOOUT|SHELL_WRITE|SHELL_READ)) == 0)
46504650
{
4651-
/* Use a terminal window to run the command in. */
4652-
x = mch_call_shell_terminal(cmd, options);
4651+
char_u *cmdbase = cmd;
4652+
4653+
// Skip a leading quote and (.
4654+
while (*cmdbase == '"' || *cmdbase == '(')
4655+
++cmdbase;
4656+
4657+
// Check the command does not begin with "start "
4658+
if (STRNICMP(cmdbase, "start", 5) != 0 || !VIM_ISWHITE(cmdbase[5]))
4659+
{
4660+
// Use a terminal window to run the command in.
4661+
x = mch_call_shell_terminal(cmd, options);
46534662
# ifdef FEAT_TITLE
4654-
resettitle();
4663+
resettitle();
46554664
# endif
4656-
return x;
4665+
return x;
4666+
}
46574667
}
46584668
#endif
46594669

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,8 @@ static char *(features[]) =
767767

768768
static int included_patches[] =
769769
{ /* Add new patch number below this line */
770+
/**/
771+
1492,
770772
/**/
771773
1491,
772774
/**/

0 commit comments

Comments
 (0)