Permalink
Browse files

patch 8.0.0949: winpty.dll name is fixed

Problem:    winpty.dll name is fixed.
Solution:   Add the 'winptydll' option. Make the default name depend on
            whether it is a 32-bit or 64-bit build. (idea by Yasuhiro
            Matsumoto, closes #1978)
  • Loading branch information...
brammool committed Aug 16, 2017
1 parent 989a70c commit 9e13aa7729486d79a530ecae1a7a95d10da27d61
Showing with 41 additions and 3 deletions.
  1. +14 −0 runtime/doc/options.txt
  2. +14 −0 src/option.c
  3. +3 −0 src/option.h
  4. +8 −3 src/terminal.c
  5. +2 −0 src/version.c
View
@@ -8831,6 +8831,20 @@ A jump table for the options with a short description can be found at |Q_op|.
large number, it will cause errors when opening more than a few
windows. A value of 0 to 12 is reasonable.
*'winptydll'*
'winptydll' string (default "winpty32.dll" or "winpty64.dll")
global
{not in Vi}
{only available when compiled with the |terminal|
feature on MS-Windows}
Specifies the name of the winpty shared library, used for the
|:terminal| command. The default depends on whether was build as a
32-bit or 64-bit executable. If not found, "win32pty.dll" is tried as

This comment has been minimized.

Show comment
Hide comment
@h-east

h-east Aug 17, 2017

It seems using "winpty.dll" in the source code.

@h-east

h-east Aug 17, 2017

It seems using "winpty.dll" in the source code.

a fallback.
Environment variables are expanded |:set_env|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'winwidth'* *'wiw'* *E592*
'winwidth' 'wiw' number (default 20)
global
View
@@ -3098,6 +3098,20 @@ static struct vimoption options[] =
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)1L, (char_u *)0L} SCRIPTID_INIT},
{"winptydll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
#if defined(WIN3264) && defined(TERMINAL)
(char_u *)&p_winptydll, PV_NONE, {
# ifdef _WIN64
(char_u *)"winpty64.dll",
# else
(char_u *)"winpty32.dll",
# endif
(char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"winwidth", "wiw", P_NUM|P_VI_DEF,
#ifdef FEAT_WINDOWS
(char_u *)&p_wiw, PV_NONE,
View
@@ -966,6 +966,9 @@ EXTERN long p_wmh; /* 'winminheight' */
EXTERN long p_wmw; /* 'winminwidth' */
EXTERN long p_wiw; /* 'winwidth' */
#endif
#if defined(WIN3264) && defined(TERMINAL)
EXTERN char_u *p_winptydll; /* 'winptydll' */
#endif
EXTERN int p_ws; /* 'wrapscan' */
EXTERN int p_write; /* 'write' */
EXTERN int p_wa; /* 'writeany' */
View
@@ -38,6 +38,7 @@
* in tl_scrollback are no longer used.
*
* TODO:
* - make [range]terminal pipe [range] lines to the terminal
* - implement term_setsize()
* - add test for giving error for invalid 'termsize' value.
* - support minimal size when 'termsize' is "rows*cols".
@@ -2768,11 +2769,15 @@ dyn_winpty_init(void)
/* No need to initialize twice. */
if (hWinPtyDLL)
return 1;
/* Load winpty.dll */
hWinPtyDLL = vimLoadLib(WINPTY_DLL);
/* Load winpty.dll, prefer using the 'winptydll' option, fall back to just
* winpty.dll. */
if (*p_winptydll != NUL)
hWinPtyDLL = vimLoadLib((char *)p_winptydll);
if (!hWinPtyDLL)
hWinPtyDLL = vimLoadLib(WINPTY_DLL);
if (!hWinPtyDLL)
{
EMSG2(_(e_loadlib), WINPTY_DLL);
EMSG2(_(e_loadlib), *p_winptydll != NUL ? p_winptydll : WINPTY_DLL);
return 0;
}
for (i = 0; winpty_entry[i].name != NULL
View
@@ -769,6 +769,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
949,
/**/
948,
/**/

3 comments on commit 9e13aa7

@mattn

This comment has been minimized.

Show comment
Hide comment
@mattn

mattn Aug 17, 2017

Windows build is broken.

diff --git a/src/option.h b/src/option.h
index b772a8ede..bfbea39e2 100644
--- a/src/option.h
+++ b/src/option.h
@@ -966,7 +966,7 @@ EXTERN long	p_wmh;		/* 'winminheight' */
 EXTERN long	p_wmw;		/* 'winminwidth' */
 EXTERN long	p_wiw;		/* 'winwidth' */
 #endif
-#if defined(WIN3264) && defined(TERMINAL)
+#if defined(WIN3264) && defined(FEAT_TERMINAL)
 EXTERN char_u	*p_winptydll;	/* 'winptydll' */
 #endif
 EXTERN int	p_ws;		/* 'wrapscan' */

mattn replied Aug 17, 2017

Windows build is broken.

diff --git a/src/option.h b/src/option.h
index b772a8ede..bfbea39e2 100644
--- a/src/option.h
+++ b/src/option.h
@@ -966,7 +966,7 @@ EXTERN long	p_wmh;		/* 'winminheight' */
 EXTERN long	p_wmw;		/* 'winminwidth' */
 EXTERN long	p_wiw;		/* 'winwidth' */
 #endif
-#if defined(WIN3264) && defined(TERMINAL)
+#if defined(WIN3264) && defined(FEAT_TERMINAL)
 EXTERN char_u	*p_winptydll;	/* 'winptydll' */
 #endif
 EXTERN int	p_ws;		/* 'wrapscan' */
@mattn

This comment has been minimized.

Show comment
Hide comment
@mattn

mattn Aug 17, 2017

One more patch to fix compilation warning.

diff --git a/src/terminal.c b/src/terminal.c
index c4fa84767..ba56b2c30 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -2777,7 +2777,8 @@ dyn_winpty_init(void)
 	hWinPtyDLL = vimLoadLib(WINPTY_DLL);
     if (!hWinPtyDLL)
     {
-	EMSG2(_(e_loadlib), *p_winptydll != NUL ? p_winptydll : WINPTY_DLL);
+	EMSG2(_(e_loadlib), *p_winptydll != NUL ?
+		p_winptydll : (char_u*)WINPTY_DLL);
 	return 0;
     }
     for (i = 0; winpty_entry[i].name != NULL

mattn replied Aug 17, 2017

One more patch to fix compilation warning.

diff --git a/src/terminal.c b/src/terminal.c
index c4fa84767..ba56b2c30 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -2777,7 +2777,8 @@ dyn_winpty_init(void)
 	hWinPtyDLL = vimLoadLib(WINPTY_DLL);
     if (!hWinPtyDLL)
     {
-	EMSG2(_(e_loadlib), *p_winptydll != NUL ? p_winptydll : WINPTY_DLL);
+	EMSG2(_(e_loadlib), *p_winptydll != NUL ?
+		p_winptydll : (char_u*)WINPTY_DLL);
 	return 0;
     }
     for (i = 0; winpty_entry[i].name != NULL
@mattn

This comment has been minimized.

Show comment
Hide comment
@mattn

mattn Aug 17, 2017

Hmm, crash on Windows. I'll make pull-request in later.

mattn replied Aug 17, 2017

Hmm, crash on Windows. I'll make pull-request in later.

Please sign in to comment.