Skip to content

Commit cfbdbf7

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 586b8e5 + 28cf44f commit cfbdbf7

46 files changed

Lines changed: 855 additions & 91 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ MINOR = 2
152152
# > cd src
153153
# > msvc2015.bat
154154
# - Build the console binary:
155-
# > nmake -f Mae_mvc.mak
155+
# > nmake -f Make_mvc.mak
156156
# - Run the tests and check the output:
157157
# > nmake -f Make_mvc.mak testclean
158158
# > nmake -f Make_mvc.mak test

ci/appveyor.bat

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ sed -e "s/@<<$/@<< | sed -e 's#.*\\\\r.*##'/" Make_mvc.mak > Make_mvc2.mak
1111
echo "Building MSVC 64bit console Version"
1212
nmake -f Make_mvc2.mak CPU=AMD64 ^
1313
OLE=no GUI=no IME=yes ICONV=yes DEBUG=no ^
14-
FEATURES=%FEATURE% || exit 1
14+
FEATURES=%FEATURE%
15+
if not exist vim.exe (
16+
echo Build failure.
17+
exit 1
18+
)
1519

1620
:: build MSVC huge version with python and channel support
1721
:: GUI needs to be last, so that testing works
@@ -21,16 +25,20 @@ if "%FEATURE%" == "HUGE" (
2125
OLE=no GUI=yes IME=yes ICONV=yes DEBUG=no POSTSCRIPT=yes ^
2226
PYTHON_VER=27 DYNAMIC_PYTHON=yes PYTHON=C:\Python27-x64 ^
2327
PYTHON3_VER=35 DYNAMIC_PYTHON3=yes PYTHON3=C:\Python35-x64 ^
24-
FEATURES=%FEATURE% || exit 1
28+
FEATURES=%FEATURE%
2529
) ELSE (
2630
nmake -f Make_mvc2.mak CPU=AMD64 ^
2731
OLE=no GUI=yes IME=yes ICONV=yes DEBUG=no ^
28-
FEATURES=%FEATURE% || exit 1
32+
FEATURES=%FEATURE%
33+
)
34+
if not exist gvim.exe (
35+
echo Build failure.
36+
exit 1
2937
)
30-
.\gvim -u NONE -c "redir @a | ver |0put a | wq" ver_msvc.txt
38+
.\gvim -u NONE -c "redir @a | ver |0put a | wq" ver_msvc.txt || exit 1
3139

3240
echo "version output MSVC console"
33-
.\vim --version
41+
.\vim --version || exit 1
3442
echo "version output MSVC GUI"
35-
type ver_msvc.txt
43+
type ver_msvc.txt || exit 1
3644
cd ..

runtime/doc/starting.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ giving the mapping.
10371037

10381038

10391039
Defaults without a .vimrc file ~
1040-
*defaults.vim*
1040+
*defaults.vim* *E1187*
10411041
If Vim is started normally and no user vimrc file is found, the
10421042
$VIMRUNTIME/defaults.vim script is loaded. This will set 'compatible' off,
10431043
switch on syntax highlighting and a few more things. See the script for

src/drawline.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,6 +1981,12 @@ win_line(
19811981
// TODO: is passing p for start of the line OK?
19821982
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
19831983
NULL) - 1;
1984+
1985+
// We have just drawn the showbreak value, no need to add
1986+
// space for it again
1987+
if (vcol == vcol_sbr)
1988+
n_extra -= MB_CHARLEN(get_showbreak_value(wp));
1989+
19841990
if (c == TAB && n_extra + col > wp->w_width)
19851991
# ifdef FEAT_VARTABS
19861992
n_extra = tabstop_padding(vcol, wp->w_buffer->b_p_ts,

src/errors.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,3 +413,5 @@ EXTERN char e_missing_redir_end[]
413413
INIT(= N_("E1185: Missing :redir END"));
414414
EXTERN char e_expression_does_not_result_in_value_str[]
415415
INIT(= N_("E1186: Expression does not result in a value: %s"));
416+
EXTERN char e_failed_to_source_defaults[]
417+
INIT(= N_("E1187: Failed to source defaults.vim"));

src/eval.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,9 @@ set_var_lval(
13091309
{
13101310
cc = *endp;
13111311
*endp = NUL;
1312+
if (in_vim9script() && check_reserved_name(lp->ll_name) == FAIL)
1313+
return;
1314+
13121315
if (lp->ll_blob != NULL)
13131316
{
13141317
int error = FALSE, val;
@@ -2358,7 +2361,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
23582361
++*arg;
23592362
if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[1]))
23602363
{
2361-
error_white_both(p, op_falsy ? 2 : 1);
2364+
error_white_both(*arg - (op_falsy ? 1 : 0), op_falsy ? 2 : 1);
23622365
clear_tv(rettv);
23632366
return FAIL;
23642367
}
@@ -2406,7 +2409,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
24062409
*/
24072410
if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[1]))
24082411
{
2409-
error_white_both(p, 1);
2412+
error_white_both(*arg, 1);
24102413
clear_tv(rettv);
24112414
evalarg_used->eval_flags = orig_flags;
24122415
return FAIL;
@@ -2511,7 +2514,7 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
25112514
*/
25122515
if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[2]))
25132516
{
2514-
error_white_both(p, 2);
2517+
error_white_both(*arg, 2);
25152518
clear_tv(rettv);
25162519
return FAIL;
25172520
}
@@ -2637,7 +2640,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
26372640
*/
26382641
if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[2]))
26392642
{
2640-
error_white_both(p, 2);
2643+
error_white_both(*arg, 2);
26412644
clear_tv(rettv);
26422645
return FAIL;
26432646
}
@@ -2735,10 +2738,13 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
27352738
? 0 : (evalarg->eval_flags & EVAL_EVALUATE);
27362739

27372740
if (getnext)
2741+
{
27382742
*arg = eval_next_line(evalarg);
2743+
p = *arg;
2744+
}
27392745
else if (evaluate && vim9script && !VIM_ISWHITE(**arg))
27402746
{
2741-
error_white_both(p, len);
2747+
error_white_both(*arg, len);
27422748
clear_tv(rettv);
27432749
return FAIL;
27442750
}
@@ -2898,7 +2904,7 @@ eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
28982904
{
28992905
if (evaluate && vim9script && !VIM_ISWHITE(**arg))
29002906
{
2901-
error_white_both(p, oplen);
2907+
error_white_both(*arg, oplen);
29022908
clear_tv(rettv);
29032909
return FAIL;
29042910
}
@@ -2934,7 +2940,7 @@ eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
29342940
*/
29352941
if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[oplen]))
29362942
{
2937-
error_white_both(p, oplen);
2943+
error_white_both(*arg, oplen);
29382944
clear_tv(rettv);
29392945
return FAIL;
29402946
}
@@ -3130,7 +3136,7 @@ eval6(
31303136
{
31313137
if (evaluate && in_vim9script() && !VIM_ISWHITE(**arg))
31323138
{
3133-
error_white_both(p, 1);
3139+
error_white_both(*arg, 1);
31343140
clear_tv(rettv);
31353141
return FAIL;
31363142
}

src/ex_docmd.c

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3398,8 +3398,11 @@ find_ex_command(
33983398
int len;
33993399
char_u *p;
34003400
int i;
3401+
#ifndef FEAT_EVAL
3402+
int vim9 = FALSE;
3403+
#else
3404+
int vim9 = in_vim9script();
34013405

3402-
#ifdef FEAT_EVAL
34033406
/*
34043407
* Recognize a Vim9 script function/method call and assignment:
34053408
* "lvar = value", "lvar(arg)", "[1, 2 3]->Func()"
@@ -3562,12 +3565,13 @@ find_ex_command(
35623565
* - the "d" command can directly be followed by 'l' or 'p' flag.
35633566
*/
35643567
p = eap->cmd;
3565-
if (*p == 'k')
3568+
if (!vim9 && *p == 'k')
35663569
{
35673570
eap->cmdidx = CMD_k;
35683571
++p;
35693572
}
3570-
else if (p[0] == 's'
3573+
else if (!vim9
3574+
&& p[0] == 's'
35713575
&& ((p[1] == 'c' && (p[2] == NUL || (p[2] != 's' && p[2] != 'r'
35723576
&& (p[3] == NUL || (p[3] != 'i' && p[4] != 'p')))))
35733577
|| p[1] == 'g'
@@ -3600,7 +3604,7 @@ find_ex_command(
36003604
if (p == eap->cmd && vim_strchr((char_u *)"@*!=><&~#}", *p) != NULL)
36013605
++p;
36023606
len = (int)(p - eap->cmd);
3603-
if (*eap->cmd == 'd' && (p[-1] == 'l' || p[-1] == 'p'))
3607+
if (!vim9 && *eap->cmd == 'd' && (p[-1] == 'l' || p[-1] == 'p'))
36043608
{
36053609
// Check for ":dl", ":dell", etc. to ":deletel": that's
36063610
// :delete with the 'l' flag. Same for 'p'.
@@ -3677,7 +3681,7 @@ find_ex_command(
36773681

36783682
#ifdef FEAT_EVAL
36793683
if (eap->cmdidx < CMD_SIZE
3680-
&& in_vim9script()
3684+
&& vim9
36813685
&& !IS_WHITE_OR_NUL(*p) && *p != '\n' && *p != '!'
36823686
&& (eap->cmdidx < 0 ||
36833687
(cmdnames[eap->cmdidx].cmd_argt & EX_NONWHITE_OK) == 0))
@@ -3797,17 +3801,32 @@ f_fullcommand(typval_T *argvars, typval_T *rettv)
37973801
char_u *name = argvars[0].vval.v_string;
37983802
char_u *p;
37993803

3800-
while (name[0] != NUL && name[0] == ':')
3804+
rettv->v_type = VAR_STRING;
3805+
rettv->vval.v_string = NULL;
3806+
if (name == NULL)
3807+
return;
3808+
3809+
while (*name != NUL && *name == ':')
38013810
name++;
38023811
name = skip_range(name, TRUE, NULL);
38033812

3804-
rettv->v_type = VAR_STRING;
3805-
38063813
ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name;
38073814
ea.cmdidx = (cmdidx_T)0;
3815+
ea.addr_count = 0;
38083816
p = find_ex_command(&ea, NULL, NULL, NULL);
38093817
if (p == NULL || ea.cmdidx == CMD_SIZE)
38103818
return;
3819+
if (in_vim9script())
3820+
{
3821+
int res;
3822+
3823+
++emsg_silent;
3824+
res = not_in_vim9(&ea);
3825+
--emsg_silent;
3826+
3827+
if (res == FAIL)
3828+
return;
3829+
}
38113830

38123831
rettv->vval.v_string = vim_strsave(IS_USER_CMDIDX(ea.cmdidx)
38133832
? get_user_commands(NULL, ea.useridx)
@@ -5485,7 +5504,7 @@ not_exiting(void)
54855504
settmode(TMODE_RAW);
54865505
}
54875506

5488-
static int
5507+
int
54895508
before_quit_autocmds(win_T *wp, int quit_all, int forceit)
54905509
{
54915510
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, wp->w_buffer);
@@ -5559,7 +5578,7 @@ ex_quit(exarg_T *eap)
55595578
#endif
55605579

55615580
/*
5562-
* If there are more files or windows we won't exit.
5581+
* If there is only one relevant window we will exit.
55635582
*/
55645583
if (check_more(FALSE, eap->forceit) == OK && only_one_window())
55655584
exiting = TRUE;
@@ -6076,7 +6095,7 @@ ex_stop(exarg_T *eap)
60766095
}
60776096

60786097
/*
6079-
* ":exit", ":xit" and ":wq": Write file and quite the current window.
6098+
* ":exit", ":xit" and ":wq": Write file and quit the current window.
60806099
*/
60816100
static void
60826101
ex_exit(exarg_T *eap)
@@ -6099,17 +6118,17 @@ ex_exit(exarg_T *eap)
60996118
return;
61006119
}
61016120

6102-
if (before_quit_autocmds(curwin, FALSE, eap->forceit))
6103-
return;
6104-
61056121
/*
6106-
* if more files or windows we won't exit
6122+
* we plan to exit if there is only one relevant window
61076123
*/
61086124
if (check_more(FALSE, eap->forceit) == OK && only_one_window())
61096125
exiting = TRUE;
6110-
if ( ((eap->cmdidx == CMD_wq
6111-
|| curbufIsChanged())
6112-
&& do_write(eap) == FAIL)
6126+
6127+
// Write the buffer for ":wq" or when it was changed.
6128+
// Trigger QuitPre and ExitPre.
6129+
// Check if we can exit now, after autocommands have changed things.
6130+
if (((eap->cmdidx == CMD_wq || curbufIsChanged()) && do_write(eap) == FAIL)
6131+
|| before_quit_autocmds(curwin, FALSE, eap->forceit)
61136132
|| check_more(TRUE, eap->forceit) == FAIL
61146133
|| (only_one_window() && check_changed_any(eap->forceit, FALSE)))
61156134
{

src/gui.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +866,10 @@ gui_exit(int rc)
866866
void
867867
gui_shell_closed(void)
868868
{
869-
cmdmod_T save_cmdmod;
869+
cmdmod_T save_cmdmod = cmdmod;
870870

871-
save_cmdmod = cmdmod;
871+
if (before_quit_autocmds(curwin, TRUE, FALSE))
872+
return;
872873

873874
// Only exit when there are no changed files
874875
exiting = TRUE;

src/if_perl.xs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,12 +700,41 @@ S_POPMARK(pTHX)
700700
/* perl-5.32 needs Perl_POPMARK */
701701
# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
702702
# define Perl_POPMARK S_POPMARK
703+
# endif
704+
705+
/* perl-5.34 needs Perl_SvTRUE_common; used in SvTRUE_nomg_NN */
706+
# if (PERL_REVISION == 5) && (PERL_VERSION >= 34)
707+
PERL_STATIC_INLINE bool
708+
Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback)
709+
{
710+
if (UNLIKELY(SvIMMORTAL_INTERP(sv)))
711+
return SvIMMORTAL_TRUE(sv);
712+
713+
if (! SvOK(sv))
714+
return FALSE;
715+
716+
if (SvPOK(sv))
717+
return SvPVXtrue(sv);
718+
719+
if (SvIOK(sv))
720+
return SvIVX(sv) != 0; /* casts to bool */
721+
722+
if (SvROK(sv) && !(SvOBJECT(SvRV(sv)) && HvAMAGIC(SvSTASH(SvRV(sv)))))
723+
return TRUE;
724+
725+
if (sv_2bool_is_fallback)
726+
return sv_2bool_nomg(sv);
727+
728+
return isGV_with_GP(sv);
729+
}
730+
# endif
703731

704732
/* perl-5.32 needs Perl_SvTRUE */
733+
# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
705734
PERL_STATIC_INLINE bool
706735
Perl_SvTRUE(pTHX_ SV *sv) {
707736
if (!LIKELY(sv))
708-
return FALSE;
737+
return FALSE;
709738
SvGETMAGIC(sv);
710739
return SvTRUE_nomg_NN(sv);
711740
}

src/main.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3213,7 +3213,11 @@ source_startup_scripts(mparm_T *parmp)
32133213
if (parmp->use_vimrc != NULL)
32143214
{
32153215
if (STRCMP(parmp->use_vimrc, "DEFAULTS") == 0)
3216-
do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL);
3216+
{
3217+
if (do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL)
3218+
!= OK)
3219+
emsg(e_failed_to_source_defaults);
3220+
}
32173221
else if (STRCMP(parmp->use_vimrc, "NONE") == 0
32183222
|| STRCMP(parmp->use_vimrc, "NORC") == 0)
32193223
{
@@ -3285,7 +3289,9 @@ source_startup_scripts(mparm_T *parmp)
32853289
&& !has_dash_c_arg)
32863290
{
32873291
// When no .vimrc file was found: source defaults.vim.
3288-
do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL);
3292+
if (do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE,
3293+
NULL) == FAIL)
3294+
emsg(e_failed_to_source_defaults);
32893295
}
32903296
}
32913297

0 commit comments

Comments
 (0)