Skip to content

Commit 2cbe15e

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 4d62904 + 4799cef commit 2cbe15e

27 files changed

+667
-197
lines changed

runtime/filetype.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,9 @@ au BufNewFile,BufRead *.pk setf poke
13831383
" Protocols
13841384
au BufNewFile,BufRead */etc/protocols setf protocols
13851385

1386+
" Pyret
1387+
au BufNewFile,BufRead *.arr setf pyret
1388+
13861389
" Pyrex
13871390
au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
13881391

@@ -1623,7 +1626,7 @@ au BufNewFile,BufRead .zshrc,.zshenv,.zlogin,.zlogout,.zcompdump setf zsh
16231626
au BufNewFile,BufRead *.zsh setf zsh
16241627

16251628
" Scheme
1626-
au BufNewFile,BufRead *.scm,*.ss,*.rkt setf scheme
1629+
au BufNewFile,BufRead *.scm,*.ss,*.rkt,*.rktd,*.rktl setf scheme
16271630

16281631
" Screen RC
16291632
au BufNewFile,BufRead .screenrc,screenrc setf screen

src/errors.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,3 +652,5 @@ EXTERN char e_exists_compiled_can_only_be_used_in_def_function[]
652652
INIT(= N_("E1233: exists_compiled() can only be used in a :def function"));
653653
EXTERN char e_legacy_must_be_followed_by_command[]
654654
INIT(= N_("E1234: legacy must be followed by a command"));
655+
EXTERN char e_function_reference_is_not_set[]
656+
INIT(= N_("E1235: Function reference is not set"));

src/eval.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,13 @@ get_lval(
887887
if (*p == ':')
888888
{
889889
scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
890-
char_u *tp = skipwhite(p + 1);
890+
char_u *tp = skipwhite(p + 1);
891+
892+
if (tp == p + 1 && !quiet)
893+
{
894+
semsg(_(e_white_space_required_after_str_str), ":", p);
895+
return NULL;
896+
}
891897

892898
// parse the type after the name
893899
lp->ll_type = parse_type(&tp, &si->sn_type_list, !quiet);

src/evalfunc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,9 +2307,10 @@ get_function_name(expand_T *xp, int idx)
23072307
if (intidx < 0)
23082308
{
23092309
name = get_user_func_name(xp, idx);
2310-
if (name != NULL && *name != NUL)
2310+
if (name != NULL)
23112311
{
2312-
if (*name != '<' && STRNCMP("g:", xp->xp_pattern, 2) == 0)
2312+
if (*name != NUL && *name != '<'
2313+
&& STRNCMP("g:", xp->xp_pattern, 2) == 0)
23132314
return cat_prefix_varname('g', name);
23142315
return name;
23152316
}

src/ex_cmds.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,6 +2648,8 @@ do_ecmd(
26482648
*/
26492649
if (other_file)
26502650
{
2651+
int prev_alt_fnum = curwin->w_alt_fnum;
2652+
26512653
if (!(flags & (ECMD_ADDBUF | ECMD_ALTBUF)))
26522654
{
26532655
if ((cmdmod.cmod_flags & CMOD_KEEPALT) == 0)
@@ -2691,6 +2693,10 @@ do_ecmd(
26912693
}
26922694
if (buf == NULL)
26932695
goto theend;
2696+
if (curwin->w_alt_fnum == buf->b_fnum && prev_alt_fnum != 0)
2697+
// reusing the buffer, keep the old alternate file
2698+
curwin->w_alt_fnum = prev_alt_fnum;
2699+
26942700
if (buf->b_ml.ml_mfp == NULL) // no memfile yet
26952701
{
26962702
oldbuf = FALSE;

src/ex_docmd.c

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3431,12 +3431,41 @@ find_ex_command(
34313431
{
34323432
char_u *pskip = skip_option_env_lead(eap->cmd);
34333433

3434-
if (vim_strchr((char_u *)"{('[\"@", *p) != NULL
3434+
if (vim_strchr((char_u *)"{('[\"@&$", *p) != NULL
34353435
|| ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL))
34363436
{
34373437
int oplen;
34383438
int heredoc;
3439-
char_u *swp = skipwhite(p);
3439+
char_u *swp;
3440+
3441+
if (*eap->cmd == '&'
3442+
|| *eap->cmd == '$'
3443+
|| (eap->cmd[0] == '@'
3444+
&& (valid_yank_reg(eap->cmd[1], FALSE)
3445+
|| eap->cmd[1] == '@')))
3446+
{
3447+
if (*eap->cmd == '&')
3448+
{
3449+
p = eap->cmd + 1;
3450+
if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0)
3451+
p += 2;
3452+
p = to_name_end(p, FALSE);
3453+
}
3454+
else if (*eap->cmd == '$')
3455+
p = to_name_end(eap->cmd + 1, FALSE);
3456+
else
3457+
p = eap->cmd + 2;
3458+
if (ends_excmd(*skipwhite(p)))
3459+
{
3460+
// "&option <NL>", "$ENV <NL>" and "@r <NL>" are the start
3461+
// of an expression.
3462+
eap->cmdidx = CMD_eval;
3463+
return eap->cmd;
3464+
}
3465+
// "&option" can be followed by "->" or "=", check below
3466+
}
3467+
3468+
swp = skipwhite(p);
34403469

34413470
if (
34423471
// "(..." is an expression.
@@ -3536,10 +3565,10 @@ find_ex_command(
35363565

35373566
// Recognize an assignment if we recognize the variable name:
35383567
// "g:var = expr"
3568+
// "@r = expr"
3569+
// "&opt = expr"
35393570
// "var = expr" where "var" is a variable name or we are skipping
35403571
// (variable declaration might have been skipped).
3541-
if (*eap->cmd == '@')
3542-
p = eap->cmd + 2;
35433572
oplen = assignment_len(skipwhite(p), &heredoc);
35443573
if (oplen > 0)
35453574
{

src/ex_eval.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,26 @@ report_discard_pending(int pending, void *value)
887887
}
888888
}
889889

890+
int
891+
cmd_is_name_only(char_u *arg)
892+
{
893+
char_u *p = arg;
894+
char_u *alias;
895+
int name_only = FALSE;
896+
897+
if (*p == '&')
898+
{
899+
++p;
900+
if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0)
901+
p += 2;
902+
}
903+
else if (*p == '@')
904+
++p;
905+
get_name_len(&p, &alias, FALSE, FALSE);
906+
name_only = ends_excmd2(arg, skipwhite(p));
907+
vim_free(alias);
908+
return name_only;
909+
}
890910

891911
/*
892912
* ":eval".
@@ -897,18 +917,10 @@ ex_eval(exarg_T *eap)
897917
typval_T tv;
898918
evalarg_T evalarg;
899919
int name_only = FALSE;
900-
char_u *p;
901920
long lnum = SOURCING_LNUM;
902921

903922
if (in_vim9script())
904-
{
905-
char_u *alias;
906-
907-
p = eap->arg;
908-
get_name_len(&p, &alias, FALSE, FALSE);
909-
name_only = ends_excmd2(eap->arg, skipwhite(p));
910-
vim_free(alias);
911-
}
923+
name_only = cmd_is_name_only(eap->arg);
912924

913925
fill_evalarg_from_eap(&evalarg, eap, eap->skip);
914926

src/memline.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ ml_open(buf_T *buf)
289289
buf->b_ml.ml_line_lnum = 0; // no cached line
290290
#ifdef FEAT_BYTEOFF
291291
buf->b_ml.ml_chunksize = NULL;
292+
buf->b_ml.ml_usedchunks = 0;
292293
#endif
293294

294295
if (cmdmod.cmod_flags & CMOD_NOSWAPFILE)
@@ -3251,9 +3252,15 @@ ml_append_int(
32513252
}
32523253

32533254
#ifdef FEAT_BYTEOFF
3255+
# ifdef FEAT_PROP_POPUP
3256+
if (curbuf->b_has_textprop)
3257+
// only use the space needed for the text, ignore properties
3258+
len = (colnr_T)STRLEN(line) + 1;
3259+
# endif
32543260
// The line was inserted below 'lnum'
32553261
ml_updatechunk(buf, lnum + 1, (long)len, ML_CHNK_ADDLINE);
32563262
#endif
3263+
32573264
#ifdef FEAT_NETBEANS_INTG
32583265
if (netbeans_active())
32593266
{
@@ -3601,7 +3608,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int flags)
36013608
int ret = FAIL;
36023609
#ifdef FEAT_PROP_POPUP
36033610
char_u *textprop_save = NULL;
3604-
int textprop_save_len;
3611+
int textprop_save_len = 0;
36053612
#endif
36063613

36073614
if (lowest_marked && lowest_marked > lnum)
@@ -3752,7 +3759,11 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int flags)
37523759
}
37533760

37543761
#ifdef FEAT_BYTEOFF
3755-
ml_updatechunk(buf, lnum, line_size, ML_CHNK_DELLINE);
3762+
ml_updatechunk(buf, lnum, line_size
3763+
# ifdef FEAT_PROP_POPUP
3764+
- textprop_save_len
3765+
# endif
3766+
, ML_CHNK_DELLINE);
37563767
#endif
37573768
ret = OK;
37583769

src/ops.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,8 @@ op_delete(oparg_T *oap)
942942
curwin->w_cursor = curpos; // restore curwin->w_cursor
943943
(void)do_join(2, FALSE, FALSE, FALSE, FALSE);
944944
}
945-
auto_format(FALSE, TRUE);
945+
if (oap->op_type == OP_DELETE)
946+
auto_format(FALSE, TRUE);
946947
}
947948

948949
msgmore(curbuf->b_ml.ml_line_count - old_lcount);
@@ -1809,6 +1810,7 @@ op_change(oparg_T *oap)
18091810
vim_free(ins_text);
18101811
}
18111812
}
1813+
auto_format(FALSE, TRUE);
18121814

18131815
return retval;
18141816
}

src/proto/ex_eval.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ int throw_exception(void *value, except_type_T type, char_u *cmdname);
1212
void discard_current_exception(void);
1313
void catch_exception(except_T *excp);
1414
void report_make_pending(int pending, void *value);
15+
int cmd_is_name_only(char_u *arg);
1516
void ex_eval(exarg_T *eap);
1617
void ex_if(exarg_T *eap);
1718
void ex_endif(exarg_T *eap);

0 commit comments

Comments
 (0)