Skip to content

Commit f4ab9b3

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 47d9133 + 9e13aa7 commit f4ab9b3

10 files changed

Lines changed: 78 additions & 9 deletions

File tree

runtime/doc/options.txt

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

9041+
*'winptydll'*
9042+
'winptydll' string (default "winpty32.dll" or "winpty64.dll")
9043+
global
9044+
{not in Vi}
9045+
{only available when compiled with the |terminal|
9046+
feature on MS-Windows}
9047+
Specifies the name of the winpty shared library, used for the
9048+
|:terminal| command. The default depends on whether was build as a
9049+
32-bit or 64-bit executable. If not found, "win32pty.dll" is tried as
9050+
a fallback.
9051+
Environment variables are expanded |:set_env|.
9052+
This option cannot be set from a |modeline| or in the |sandbox|, for
9053+
security reasons.
9054+
90419055
*'winwidth'* *'wiw'* *E592*
90429056
'winwidth' 'wiw' number (default 20)
90439057
global

src/edit.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9432,7 +9432,7 @@ ins_mousescroll(int dir)
94329432
{
94339433
pos_T tpos;
94349434
# if defined(FEAT_WINDOWS)
9435-
win_T *old_curwin = curwin;
9435+
win_T *old_curwin = curwin, *wp;
94369436
# endif
94379437
# ifdef FEAT_INS_EXPAND
94389438
int did_scroll = FALSE;
@@ -9452,7 +9452,10 @@ ins_mousescroll(int dir)
94529452
col = mouse_col;
94539453

94549454
/* find the window at the pointer coordinates */
9455-
curwin = mouse_find_win(&row, &col);
9455+
wp = mouse_find_win(&row, &col);
9456+
if (wp == NULL)
9457+
return;
9458+
curwin = wp;
94569459
curbuf = curwin->w_buffer;
94579460
}
94589461
if (curwin == old_curwin)

src/evalfunc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4389,6 +4389,8 @@ f_getchar(typval_T *argvars, typval_T *rettv)
43894389
/* Find the window at the mouse coordinates and compute the
43904390
* text position. */
43914391
win = mouse_find_win(&row, &col);
4392+
if (win == NULL)
4393+
return;
43924394
(void)mouse_comp_pos(win, &row, &col, &lnum);
43934395
# ifdef FEAT_WINDOWS
43944396
for (wp = firstwin; wp != win; wp = wp->w_next)

src/gui.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4982,7 +4982,7 @@ gui_mouse_correct(void)
49824982
}
49834983

49844984
/*
4985-
* Find window where the mouse pointer "y" coordinate is in.
4985+
* Find window where the mouse pointer "x" / "y" coordinate is in.
49864986
*/
49874987
static win_T *
49884988
xy2win(int x UNUSED, int y UNUSED)
@@ -5006,6 +5006,8 @@ xy2win(int x UNUSED, int y UNUSED)
50065006
return NULL;
50075007
# endif
50085008
wp = mouse_find_win(&row, &col);
5009+
if (wp == NULL)
5010+
return NULL;
50095011
# ifdef FEAT_MOUSESHAPE
50105012
if (State == HITRETURN || State == ASKMORE)
50115013
{

src/normal.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,12 @@ normal_cmd(
13081308
}
13091309
#endif
13101310

1311+
#ifdef FEAT_TERMINAL
1312+
/* don't go to Insert mode from Terminal-Job mode */
1313+
if (term_use_loop())
1314+
restart_edit = 0;
1315+
#endif
1316+
13111317
/*
13121318
* May restart edit(), if we got here with CTRL-O in Insert mode (but not
13131319
* if still inside a mapping that started in Visual mode).
@@ -4629,7 +4635,7 @@ nv_mousescroll(cmdarg_T *cap)
46294635
int scroll_wheel_force = 0;
46304636
# endif
46314637
# ifdef FEAT_WINDOWS
4632-
win_T *old_curwin = curwin;
4638+
win_T *old_curwin = curwin, *wp;
46334639

46344640
if (mouse_row >= 0 && mouse_col >= 0)
46354641
{
@@ -4639,7 +4645,10 @@ nv_mousescroll(cmdarg_T *cap)
46394645
col = mouse_col;
46404646

46414647
/* find the window at the pointer coordinates */
4642-
curwin = mouse_find_win(&row, &col);
4648+
wp = mouse_find_win(&row, &col);
4649+
if (wp == NULL)
4650+
return;
4651+
curwin = wp;
46434652
curbuf = curwin->w_buffer;
46444653
}
46454654
# endif

src/option.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3195,6 +3195,20 @@ static struct vimoption options[] =
31953195
(char_u *)NULL, PV_NONE,
31963196
#endif
31973197
{(char_u *)1L, (char_u *)0L} SCRIPTID_INIT},
3198+
{"winptydll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
3199+
#if defined(WIN3264) && defined(TERMINAL)
3200+
(char_u *)&p_winptydll, PV_NONE, {
3201+
# ifdef _WIN64
3202+
(char_u *)"winpty64.dll",
3203+
# else
3204+
(char_u *)"winpty32.dll",
3205+
# endif
3206+
(char_u *)0L}
3207+
#else
3208+
(char_u *)NULL, PV_NONE,
3209+
{(char_u *)0L, (char_u *)0L}
3210+
#endif
3211+
SCRIPTID_INIT},
31983212
{"winwidth", "wiw", P_NUM|P_VI_DEF,
31993213
#ifdef FEAT_WINDOWS
32003214
(char_u *)&p_wiw, PV_NONE,

src/option.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,9 @@ EXTERN long p_wmh; /* 'winminheight' */
989989
EXTERN long p_wmw; /* 'winminwidth' */
990990
EXTERN long p_wiw; /* 'winwidth' */
991991
#endif
992+
#if defined(WIN3264) && defined(TERMINAL)
993+
EXTERN char_u *p_winptydll; /* 'winptydll' */
994+
#endif
992995
EXTERN int p_ws; /* 'wrapscan' */
993996
EXTERN int p_write; /* 'write' */
994997
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".
@@ -2773,11 +2774,15 @@ dyn_winpty_init(void)
27732774
/* No need to initialize twice. */
27742775
if (hWinPtyDLL)
27752776
return 1;
2776-
/* Load winpty.dll */
2777-
hWinPtyDLL = vimLoadLib(WINPTY_DLL);
2777+
/* Load winpty.dll, prefer using the 'winptydll' option, fall back to just
2778+
* winpty.dll. */
2779+
if (*p_winptydll != NUL)
2780+
hWinPtyDLL = vimLoadLib((char *)p_winptydll);
2781+
if (!hWinPtyDLL)
2782+
hWinPtyDLL = vimLoadLib(WINPTY_DLL);
27782783
if (!hWinPtyDLL)
27792784
{
2780-
EMSG2(_(e_loadlib), WINPTY_DLL);
2785+
EMSG2(_(e_loadlib), *p_winptydll != NUL ? p_winptydll : WINPTY_DLL);
27812786
return 0;
27822787
}
27832788
for (i = 0; winpty_entry[i].name != NULL

src/ui.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,8 @@ jump_to_mouse(
27292729
#ifdef FEAT_WINDOWS
27302730
/* find the window where the row is in */
27312731
wp = mouse_find_win(&row, &col);
2732+
if (wp == NULL)
2733+
return IN_UNKNOWN;
27322734
#else
27332735
wp = firstwin;
27342736
#endif
@@ -3137,11 +3139,13 @@ mouse_comp_pos(
31373139
/*
31383140
* Find the window at screen position "*rowp" and "*colp". The positions are
31393141
* updated to become relative to the top-left of the window.
3142+
* Returns NULL when something is wrong.
31403143
*/
31413144
win_T *
31423145
mouse_find_win(int *rowp, int *colp UNUSED)
31433146
{
31443147
frame_T *fp;
3148+
win_T *wp;
31453149

31463150
fp = topframe;
31473151
*rowp -= firstwin->w_winrow;
@@ -3168,7 +3172,12 @@ mouse_find_win(int *rowp, int *colp UNUSED)
31683172
}
31693173
}
31703174
}
3171-
return fp->fr_win;
3175+
/* When using a timer that closes a window the window might not actually
3176+
* exist. */
3177+
FOR_ALL_WINDOWS(wp)
3178+
if (wp == fp->fr_win)
3179+
return wp;
3180+
return NULL;
31723181
}
31733182
#endif
31743183

@@ -3192,6 +3201,8 @@ get_fpos_of_mouse(pos_T *mpos)
31923201
#ifdef FEAT_WINDOWS
31933202
/* find the window where the row is in */
31943203
wp = mouse_find_win(&row, &col);
3204+
if (wp == NULL)
3205+
return IN_UNKNOWN;
31953206
#else
31963207
wp = firstwin;
31973208
#endif

src/version.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,12 @@ static char *(features[]) =
784784

785785
static int included_patches[] =
786786
{ /* Add new patch number below this line */
787+
/**/
788+
949,
789+
/**/
790+
948,
791+
/**/
792+
947,
787793
/**/
788794
946,
789795
/**/

0 commit comments

Comments
 (0)