mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.0.0952: has('terminal') does not check existence of dll file
Problem: MS-Windows: has('terminal') does not check existence of dll file. Solution: Check if the winpty dll file can be loaded. (Ken Takata)
This commit is contained in:
@@ -5926,7 +5926,7 @@ f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
#ifdef FEAT_TERMGUICOLORS
|
#ifdef FEAT_TERMGUICOLORS
|
||||||
"termguicolors",
|
"termguicolors",
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_TERMINAL
|
#if defined(FEAT_TERMINAL) && !defined(WIN3264)
|
||||||
"terminal",
|
"terminal",
|
||||||
#endif
|
#endif
|
||||||
#ifdef TERMINFO
|
#ifdef TERMINFO
|
||||||
@@ -6133,6 +6133,10 @@ f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
#ifdef FEAT_NETBEANS_INTG
|
#ifdef FEAT_NETBEANS_INTG
|
||||||
else if (STRICMP(name, "netbeans_enabled") == 0)
|
else if (STRICMP(name, "netbeans_enabled") == 0)
|
||||||
n = netbeans_active();
|
n = netbeans_active();
|
||||||
|
#endif
|
||||||
|
#if defined(FEAT_TERMINAL) && defined(WIN3264)
|
||||||
|
else if (STRICMP(name, "terminal") == 0)
|
||||||
|
n = terminal_enabled();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,4 +34,5 @@ void f_term_scrape(typval_T *argvars, typval_T *rettv);
|
|||||||
void f_term_sendkeys(typval_T *argvars, typval_T *rettv);
|
void f_term_sendkeys(typval_T *argvars, typval_T *rettv);
|
||||||
void f_term_start(typval_T *argvars, typval_T *rettv);
|
void f_term_start(typval_T *argvars, typval_T *rettv);
|
||||||
void f_term_wait(typval_T *argvars, typval_T *rettv);
|
void f_term_wait(typval_T *argvars, typval_T *rettv);
|
||||||
|
int terminal_enabled(void);
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
@@ -2709,12 +2709,14 @@ f_term_wait(typval_T *argvars, typval_T *rettv UNUSED)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef WIN3264
|
# if defined(WIN3264) || defined(PROTO)
|
||||||
|
|
||||||
/**************************************
|
/**************************************
|
||||||
* 2. MS-Windows implementation.
|
* 2. MS-Windows implementation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
# ifndef PROTO
|
||||||
|
|
||||||
#define WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN 1ul
|
#define WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN 1ul
|
||||||
#define WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN 2ull
|
#define WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN 2ull
|
||||||
|
|
||||||
@@ -2737,9 +2739,10 @@ HANDLE (*winpty_agent_process)(void*);
|
|||||||
#define WINPTY_DLL "winpty.dll"
|
#define WINPTY_DLL "winpty.dll"
|
||||||
|
|
||||||
static HINSTANCE hWinPtyDLL = NULL;
|
static HINSTANCE hWinPtyDLL = NULL;
|
||||||
|
# endif
|
||||||
|
|
||||||
int
|
static int
|
||||||
dyn_winpty_init(void)
|
dyn_winpty_init(int verbose)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static struct
|
static struct
|
||||||
@@ -2768,7 +2771,7 @@ dyn_winpty_init(void)
|
|||||||
|
|
||||||
/* No need to initialize twice. */
|
/* No need to initialize twice. */
|
||||||
if (hWinPtyDLL)
|
if (hWinPtyDLL)
|
||||||
return 1;
|
return OK;
|
||||||
/* Load winpty.dll, prefer using the 'winptydll' option, fall back to just
|
/* Load winpty.dll, prefer using the 'winptydll' option, fall back to just
|
||||||
* winpty.dll. */
|
* winpty.dll. */
|
||||||
if (*p_winptydll != NUL)
|
if (*p_winptydll != NUL)
|
||||||
@@ -2777,8 +2780,10 @@ dyn_winpty_init(void)
|
|||||||
hWinPtyDLL = vimLoadLib(WINPTY_DLL);
|
hWinPtyDLL = vimLoadLib(WINPTY_DLL);
|
||||||
if (!hWinPtyDLL)
|
if (!hWinPtyDLL)
|
||||||
{
|
{
|
||||||
EMSG2(_(e_loadlib), *p_winptydll != NUL ? p_winptydll : WINPTY_DLL);
|
if (verbose)
|
||||||
return 0;
|
EMSG2(_(e_loadlib), *p_winptydll != NUL ? p_winptydll
|
||||||
|
: (char_u *)WINPTY_DLL);
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
for (i = 0; winpty_entry[i].name != NULL
|
for (i = 0; winpty_entry[i].name != NULL
|
||||||
&& winpty_entry[i].ptr != NULL; ++i)
|
&& winpty_entry[i].ptr != NULL; ++i)
|
||||||
@@ -2786,12 +2791,13 @@ dyn_winpty_init(void)
|
|||||||
if ((*winpty_entry[i].ptr = (FARPROC)GetProcAddress(hWinPtyDLL,
|
if ((*winpty_entry[i].ptr = (FARPROC)GetProcAddress(hWinPtyDLL,
|
||||||
winpty_entry[i].name)) == NULL)
|
winpty_entry[i].name)) == NULL)
|
||||||
{
|
{
|
||||||
|
if (verbose)
|
||||||
EMSG2(_(e_loadfunc), winpty_entry[i].name);
|
EMSG2(_(e_loadfunc), winpty_entry[i].name);
|
||||||
return 0;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2813,7 +2819,7 @@ term_and_job_init(term_T *term, int rows, int cols, typval_T *argvar, jobopt_T *
|
|||||||
garray_T ga;
|
garray_T ga;
|
||||||
char_u *cmd;
|
char_u *cmd;
|
||||||
|
|
||||||
if (!dyn_winpty_init())
|
if (dyn_winpty_init(TRUE) == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
if (argvar->v_type == VAR_STRING)
|
if (argvar->v_type == VAR_STRING)
|
||||||
@@ -2977,6 +2983,13 @@ term_report_winsize(term_T *term, int rows, int cols)
|
|||||||
winpty_set_size(term->tl_winpty, cols, rows, NULL);
|
winpty_set_size(term->tl_winpty, cols, rows, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
terminal_enabled(void)
|
||||||
|
{
|
||||||
|
return dyn_winpty_init(FALSE) == OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# else
|
# else
|
||||||
|
|
||||||
/**************************************
|
/**************************************
|
||||||
|
@@ -769,6 +769,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
952,
|
||||||
/**/
|
/**/
|
||||||
951,
|
951,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user