Skip to content

Commit 9e13aa7

Browse files
committed
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)
1 parent 989a70c commit 9e13aa7

5 files changed

Lines changed: 41 additions & 3 deletions

File tree

runtime/doc/options.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8831,6 +8831,20 @@ A jump table for the options with a short description can be found at |Q_op|.
88318831
large number, it will cause errors when opening more than a few
88328832
windows. A value of 0 to 12 is reasonable.
88338833

8834+
*'winptydll'*
8835+
'winptydll' string (default "winpty32.dll" or "winpty64.dll")
8836+
global
8837+
{not in Vi}
8838+
{only available when compiled with the |terminal|
8839+
feature on MS-Windows}
8840+
Specifies the name of the winpty shared library, used for the
8841+
|:terminal| command. The default depends on whether was build as a
8842+
32-bit or 64-bit executable. If not found, "win32pty.dll" is tried as
8843+
a fallback.
8844+
Environment variables are expanded |:set_env|.
8845+
This option cannot be set from a |modeline| or in the |sandbox|, for
8846+
security reasons.
8847+
88348848
*'winwidth'* *'wiw'* *E592*
88358849
'winwidth' 'wiw' number (default 20)
88368850
global

src/option.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3098,6 +3098,20 @@ static struct vimoption options[] =
30983098
(char_u *)NULL, PV_NONE,
30993099
#endif
31003100
{(char_u *)1L, (char_u *)0L} SCRIPTID_INIT},
3101+
{"winptydll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
3102+
#if defined(WIN3264) && defined(TERMINAL)
3103+
(char_u *)&p_winptydll, PV_NONE, {
3104+
# ifdef _WIN64
3105+
(char_u *)"winpty64.dll",
3106+
# else
3107+
(char_u *)"winpty32.dll",
3108+
# endif
3109+
(char_u *)0L}
3110+
#else
3111+
(char_u *)NULL, PV_NONE,
3112+
{(char_u *)0L, (char_u *)0L}
3113+
#endif
3114+
SCRIPTID_INIT},
31013115
{"winwidth", "wiw", P_NUM|P_VI_DEF,
31023116
#ifdef FEAT_WINDOWS
31033117
(char_u *)&p_wiw, PV_NONE,

src/option.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,9 @@ EXTERN long p_wmh; /* 'winminheight' */
966966
EXTERN long p_wmw; /* 'winminwidth' */
967967
EXTERN long p_wiw; /* 'winwidth' */
968968
#endif
969+
#if defined(WIN3264) && defined(TERMINAL)
970+
EXTERN char_u *p_winptydll; /* 'winptydll' */
971+
#endif
969972
EXTERN int p_ws; /* 'wrapscan' */
970973
EXTERN int p_write; /* 'write' */
971974
EXTERN int p_wa; /* 'writeany' */

src/terminal.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* in tl_scrollback are no longer used.
3939
*
4040
* TODO:
41+
* - make [range]terminal pipe [range] lines to the terminal
4142
* - implement term_setsize()
4243
* - add test for giving error for invalid 'termsize' value.
4344
* - support minimal size when 'termsize' is "rows*cols".
@@ -2768,11 +2769,15 @@ dyn_winpty_init(void)
27682769
/* No need to initialize twice. */
27692770
if (hWinPtyDLL)
27702771
return 1;
2771-
/* Load winpty.dll */
2772-
hWinPtyDLL = vimLoadLib(WINPTY_DLL);
2772+
/* Load winpty.dll, prefer using the 'winptydll' option, fall back to just
2773+
* winpty.dll. */
2774+
if (*p_winptydll != NUL)
2775+
hWinPtyDLL = vimLoadLib((char *)p_winptydll);
2776+
if (!hWinPtyDLL)
2777+
hWinPtyDLL = vimLoadLib(WINPTY_DLL);
27732778
if (!hWinPtyDLL)
27742779
{
2775-
EMSG2(_(e_loadlib), WINPTY_DLL);
2780+
EMSG2(_(e_loadlib), *p_winptydll != NUL ? p_winptydll : WINPTY_DLL);
27762781
return 0;
27772782
}
27782783
for (i = 0; winpty_entry[i].name != NULL

src/version.c

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

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
949,
772774
/**/
773775
948,
774776
/**/

0 commit comments

Comments
 (0)