Skip to content

Commit 15931f2

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents a7b753e + c6ed254 commit 15931f2

Some content is hidden

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

41 files changed

+840
-212
lines changed

.github/workflows/ci-windows.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ jobs:
7474
git config --global core.autocrlf input
7575
python_dir=$(cat "/proc/${{ matrix.cygreg }}/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON_VER_DOT}/InstallPath/@")
7676
python3_dir=$(cat "/proc/${{ matrix.cygreg }}/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}${{ matrix.pyreg }}/InstallPath/@")
77-
echo "::set-env name=PYTHON_DIR::$python_dir"
78-
echo "::set-env name=PYTHON3_DIR::$python3_dir"
77+
echo "PYTHON_DIR=$python_dir" >> $GITHUB_ENV
78+
echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
7979
8080
- uses: msys2/setup-msys2@v2
8181
if: matrix.toolchain == 'mingw'

runtime/doc/map.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,15 @@ execute a shell command, e.g.: `!ls` Or put the lines in your |vimrc|.
839839

840840
When modifyOtherKeys is enabled you can map <C-[> and <C-S-{>: >
841841
imap <C-[> [[[
842-
imap <C-S-{> {{{
843-
Without modifyOtherKeys <C-[> and <C-S-{> are indistinguishable from Esc.
842+
imap <C-{> {{{
843+
Without modifyOtherKeys <C-[> and <C-{> are indistinguishable from Esc.
844+
Note that <C-{> is used and not <C-S-[> or <C-S-{>. This works on most
845+
keyboards. Similarly, <C-}> is used instead of <C-S-]> or <C-S-}> and
846+
<C-|> instead of <C-S-\> or <C-S-|>. Note that '|' has a special meaning in a
847+
mapping, see |map-bar|.
848+
849+
WARNING: if you map <C-[> you may very well break any key codes that start
850+
with Esc. Make sure it comes AFTER other mappings.
844851

845852
A known side effect is that in Insert mode the raw escape sequence is inserted
846853
after the CTRL-V key. This can be used to check whether modifyOtherKeys is

runtime/filetype.vim

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,13 +1342,6 @@ au BufNewFile,BufRead *.rego setf rego
13421342
" Rexx
13431343
au BufNewFile,BufRead *.rex,*.orx,*.rxo,*.rxj,*.jrexx,*.rexxj,*.rexx,*.testGroup,*.testUnit setf rexx
13441344

1345-
" R (Splus)
1346-
if has("fname_case")
1347-
au BufNewFile,BufRead *.s,*.S setf r
1348-
else
1349-
au BufNewFile,BufRead *.s setf r
1350-
endif
1351-
13521345
" R Help file
13531346
if has("fname_case")
13541347
au BufNewFile,BufRead *.rd,*.Rd setf rhelp

src/errors.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,6 @@ EXTERN char e_cannot_use_let_in_vim9_script[]
278278
INIT(= N_("E1126: Cannot use :let in Vim9 script"));
279279
EXTERN char e_missing_name_after_dot[]
280280
INIT(= N_("E1127: Missing name after dot"));
281+
EXTERN char e_endblock_without_block[]
282+
INIT(= N_("E1128: } without {"));
281283
#endif

src/eval.c

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,17 @@ get_lval(
887887
return NULL;
888888
}
889889

890+
if (in_vim9script() && lp->ll_valtype == NULL
891+
&& lp->ll_tv == &v->di_tv
892+
&& ht != NULL && ht == get_script_local_ht())
893+
{
894+
svar_T *sv = find_typval_in_script(lp->ll_tv);
895+
896+
// Vim9 script local variable: get the type
897+
if (sv != NULL)
898+
lp->ll_valtype = sv->sv_type;
899+
}
900+
890901
len = -1;
891902
if (*p == '.')
892903
{
@@ -1037,6 +1048,10 @@ get_lval(
10371048
}
10381049
}
10391050

1051+
if (lp->ll_valtype != NULL)
1052+
// use the type of the member
1053+
lp->ll_valtype = lp->ll_valtype->tt_member;
1054+
10401055
if (lp->ll_di == NULL)
10411056
{
10421057
// Can't add "v:" or "a:" variable.
@@ -1148,6 +1163,10 @@ get_lval(
11481163
return NULL;
11491164
}
11501165

1166+
if (lp->ll_valtype != NULL)
1167+
// use the type of the member
1168+
lp->ll_valtype = lp->ll_valtype->tt_member;
1169+
11511170
/*
11521171
* May need to find the item or absolute index for the second
11531172
* index of a range.
@@ -1383,6 +1402,11 @@ set_var_lval(
13831402
emsg(_("E996: Cannot lock a list or dict"));
13841403
return;
13851404
}
1405+
1406+
if (lp->ll_valtype != NULL
1407+
&& check_typval_type(lp->ll_valtype, rettv, 0) == FAIL)
1408+
return;
1409+
13861410
if (lp->ll_newkey != NULL)
13871411
{
13881412
if (op != NULL && *op != '=')
@@ -3960,21 +3984,12 @@ partial_free(partial_T *pt)
39603984
else
39613985
func_ptr_unref(pt->pt_func);
39623986

3987+
// Decrease the reference count for the context of a closure. If down
3988+
// to the minimum it may be time to free it.
39633989
if (pt->pt_funcstack != NULL)
39643990
{
3965-
// Decrease the reference count for the context of a closure. If down
3966-
// to zero free it and clear the variables on the stack.
3967-
if (--pt->pt_funcstack->fs_refcount == 0)
3968-
{
3969-
garray_T *gap = &pt->pt_funcstack->fs_ga;
3970-
typval_T *stack = gap->ga_data;
3971-
3972-
for (i = 0; i < gap->ga_len; ++i)
3973-
clear_tv(stack + i);
3974-
ga_clear(gap);
3975-
vim_free(pt->pt_funcstack);
3976-
}
3977-
pt->pt_funcstack = NULL;
3991+
--pt->pt_funcstack->fs_refcount;
3992+
funcstack_check_refcount(pt->pt_funcstack);
39783993
}
39793994

39803995
vim_free(pt);
@@ -3987,8 +4002,16 @@ partial_free(partial_T *pt)
39874002
void
39884003
partial_unref(partial_T *pt)
39894004
{
3990-
if (pt != NULL && --pt->pt_refcount <= 0)
3991-
partial_free(pt);
4005+
if (pt != NULL)
4006+
{
4007+
if (--pt->pt_refcount <= 0)
4008+
partial_free(pt);
4009+
4010+
// If the reference count goes down to one, the funcstack may be the
4011+
// only reference and can be freed if no other partials reference it.
4012+
else if (pt->pt_refcount == 1 && pt->pt_funcstack != NULL)
4013+
funcstack_check_refcount(pt->pt_funcstack);
4014+
}
39924015
}
39934016

39944017
/*

src/evalvars.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first);
176176
static char_u *ex_let_one(char_u *arg, typval_T *tv, int copy, int flags, char_u *endchars, char_u *op);
177177
static int do_unlet_var(lval_T *lp, char_u *name_end, exarg_T *eap, int deep, void *cookie);
178178
static int do_lock_var(lval_T *lp, char_u *name_end, exarg_T *eap, int deep, void *cookie);
179-
static void delete_var(hashtab_T *ht, hashitem_T *hi);
180179
static void list_one_var(dictitem_T *v, char *prefix, int *first);
181180
static void list_one_var_a(char *prefix, char_u *name, int type, char_u *string, int *first);
182181

@@ -2655,7 +2654,7 @@ find_var_in_ht(
26552654
/*
26562655
* Get the script-local hashtab. NULL if not in a script context.
26572656
*/
2658-
static hashtab_T *
2657+
hashtab_T *
26592658
get_script_local_ht(void)
26602659
{
26612660
scid_T sid = current_sctx.sc_sid;
@@ -2892,7 +2891,7 @@ vars_clear_ext(hashtab_T *ht, int free_val)
28922891
* Delete a variable from hashtab "ht" at item "hi".
28932892
* Clear the variable value and free the dictitem.
28942893
*/
2895-
static void
2894+
void
28962895
delete_var(hashtab_T *ht, hashitem_T *hi)
28972896
{
28982897
dictitem_T *di = HI2DI(hi);

src/ex_cmdidxs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ static const unsigned char cmdidxs2[26][26] =
6969
/* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
7070
};
7171

72-
static const int command_count = 573;
72+
static const int command_count = 575;

src/ex_cmds.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,12 @@ EXCMD(CMD_rshift, ">", ex_operators,
18181818
EXCMD(CMD_at, "@", ex_at,
18191819
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
18201820
ADDR_LINES),
1821+
EXCMD(CMD_block, "{{{{{{{{", ex_block, // not found normally
1822+
0,
1823+
ADDR_NONE),
1824+
EXCMD(CMD_endblock, "}", ex_endblock,
1825+
EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
1826+
ADDR_NONE),
18211827
EXCMD(CMD_tilde, "~", ex_substitute,
18221828
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY,
18231829
ADDR_LINES),

src/ex_docmd.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ static void ex_psearch(exarg_T *eap);
264264
static void ex_tag(exarg_T *eap);
265265
static void ex_tag_cmd(exarg_T *eap, char_u *name);
266266
#ifndef FEAT_EVAL
267+
# define ex_block ex_ni
267268
# define ex_break ex_ni
268269
# define ex_breakadd ex_ni
269270
# define ex_breakdel ex_ni
@@ -281,6 +282,7 @@ static void ex_tag_cmd(exarg_T *eap, char_u *name);
281282
# define ex_echo ex_ni
282283
# define ex_echohl ex_ni
283284
# define ex_else ex_ni
285+
# define ex_endblock ex_ni
284286
# define ex_endfunction ex_ni
285287
# define ex_endif ex_ni
286288
# define ex_endtry ex_ni
@@ -1240,6 +1242,10 @@ do_cmdline(
12401242

12411243
if (trylevel == 0)
12421244
{
1245+
// Just in case did_throw got set but current_exception wasn't.
1246+
if (current_exception == NULL)
1247+
did_throw = FALSE;
1248+
12431249
/*
12441250
* When an exception is being thrown out of the outermost try
12451251
* conditional, discard the uncaught exception, disable the conversion
@@ -3224,7 +3230,7 @@ find_ex_command(
32243230
*p == '('
32253231
|| (p == eap->cmd
32263232
? (
3227-
// "{..." is an dict expression.
3233+
// "{..." is a dict expression or block start.
32283234
*eap->cmd == '{'
32293235
// "'string'->func()" is an expression.
32303236
|| *eap->cmd == '\''
@@ -3236,6 +3242,12 @@ find_ex_command(
32363242
// "varname->func()" is an expression.
32373243
: (*p == '-' && p[1] == '>')))
32383244
{
3245+
if (*eap->cmd == '{' && ends_excmd(*skipwhite(eap->cmd + 1)))
3246+
{
3247+
// "{" by itself is the start of a block.
3248+
eap->cmdidx = CMD_block;
3249+
return eap->cmd + 1;
3250+
}
32393251
eap->cmdidx = CMD_eval;
32403252
return eap->cmd;
32413253
}
@@ -3357,7 +3369,7 @@ find_ex_command(
33573369
}
33583370

33593371
// check for non-alpha command
3360-
if (p == eap->cmd && vim_strchr((char_u *)"@*!=><&~#", *p) != NULL)
3372+
if (p == eap->cmd && vim_strchr((char_u *)"@*!=><&~#}", *p) != NULL)
33613373
++p;
33623374
len = (int)(p - eap->cmd);
33633375
if (*eap->cmd == 'd' && (p[-1] == 'l' || p[-1] == 'p'))

0 commit comments

Comments
 (0)