Skip to content

Commit 3453167

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents c877592 + f28f2ac commit 3453167

Some content is hidden

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

60 files changed

+1341
-701
lines changed

runtime/doc/eval.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13158,7 +13158,12 @@ text...
1315813158
< If you just want a highlighted message use |:echohl|.
1315913159
And to get a beep: >
1316013160
:exe "normal \<Esc>"
13161-
<
13161+
13162+
:echoc[onsole] {expr1} .. *:echoc* *:echoconsole*
13163+
Intended for testing: works like `:echomsg` but when
13164+
running in the GUI and started from a terminal write
13165+
the text to stdout.
13166+
1316213167
*:eval*
1316313168
:eval {expr} Evaluate {expr} and discard the result. Example: >
1316413169
:eval Getlist()->Filter()->append('$')

runtime/doc/tagsrch.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -888,19 +888,25 @@ like |CTRL-]|.
888888

889889
The function used for generating the taglist is specified by setting the
890890
'tagfunc' option. The function will be called with three arguments:
891-
a:pattern The tag identifier used during the tag search.
892-
a:flags List of flags to control the function behavior.
891+
a:pattern The tag identifier or pattern used during the tag search.
892+
a:flags String containing flags to control the function behavior.
893893
a:info Dict containing the following entries:
894894
buf_ffname Full filename which can be used for priority.
895895
user_data Custom data String, if stored in the tag
896896
stack previously by tagfunc.
897897

898-
Currently two flags may be passed to the tag function:
898+
Currently up to three flags may be passed to the tag function:
899899
'c' The function was invoked by a normal command being processed
900900
(mnemonic: the tag function may use the context around the
901901
cursor to perform a better job of generating the tag list.)
902902
'i' In Insert mode, the user was completing a tag (with
903-
|i_CTRL-X_CTRL-]|).
903+
|i_CTRL-X_CTRL-]| or 'completeopt' contains `t`).
904+
'r' The first argument to tagfunc should be interpreted as a
905+
|pattern| (see |tag-regexp|), such as when using: >
906+
:tag /pat
907+
< It is also given when completing in insert mode.
908+
If this flag is not present, the argument is usually taken
909+
literally as the full tag name.
904910

905911
Note that when 'tagfunc' is set, the priority of the tags described in
906912
|tag-priority| does not apply. Instead, the priority is exactly as the

runtime/filetype.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ au BufNewFile,BufRead *.mar setf vmasm
168168
" Atlas
169169
au BufNewFile,BufRead *.atl,*.as setf atlas
170170

171+
" Atom is based on XML
172+
au BufNewFile,BufRead *.atom setf xml
173+
171174
" Autoit v3
172175
au BufNewFile,BufRead *.au3 setf autoit
173176

@@ -1394,6 +1397,9 @@ else
13941397
au BufNewFile,BufRead *.rmd,*.smd setf rmd
13951398
endif
13961399

1400+
" RSS looks like XML
1401+
au BufNewFile,BufRead *.rss setf xml
1402+
13971403
" R reStructuredText file
13981404
if has("fname_case")
13991405
au BufNewFile,BufRead *.Rrst,*.rrst,*.Srst,*.srst setf rrst

src/errors.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,3 +375,15 @@ EXTERN char e_argument_already_declared_in_script_str[]
375375
INIT(= N_("E1168: Argument already declared in the script: %s"));
376376
EXTERN char e_import_as_name_not_supported_here[]
377377
INIT(= N_("E1169: 'import * as {name}' not supported here"));
378+
EXTERN char e_cannot_use_hash_curly_to_start_comment[]
379+
INIT(= N_("E1170: Cannot use #{ to start a comment"));
380+
EXTERN char e_missing_end_block[]
381+
INIT(= N_("E1171: Missing } after inline function"));
382+
EXTERN char e_cannot_use_default_values_in_lambda[]
383+
INIT(= N_("E1172: Cannot use default values in a lambda"));
384+
EXTERN char e_text_found_after_enddef_str[]
385+
INIT(= N_("E1173: Text found after enddef: %s"));
386+
EXTERN char e_string_required_for_argument_nr[]
387+
INIT(= N_("E1174: String required for argument %d"));
388+
EXTERN char e_non_empty_string_required_for_argument_nr[]
389+
INIT(= N_("E1142: Non-empty string required for argument %d"));

src/eval.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,8 +2179,8 @@ clear_evalarg(evalarg_T *evalarg, exarg_T *eap)
21792179
evalarg->eval_tofree = NULL;
21802180
}
21812181

2182-
vim_free(evalarg->eval_tofree_lambda);
2183-
evalarg->eval_tofree_lambda = NULL;
2182+
VIM_CLEAR(evalarg->eval_tofree_cmdline);
2183+
VIM_CLEAR(evalarg->eval_tofree_lambda);
21842184
}
21852185
}
21862186

@@ -2228,7 +2228,8 @@ eval0(
22282228
if (!aborting()
22292229
&& did_emsg == did_emsg_before
22302230
&& called_emsg == called_emsg_before
2231-
&& (flags & EVAL_CONSTANT) == 0)
2231+
&& (flags & EVAL_CONSTANT) == 0
2232+
&& (!in_vim9script() || !vim9_bad_comment(p)))
22322233
semsg(_(e_invexpr2), arg);
22332234

22342235
// Some of the expression may not have been consumed. Do not check for
@@ -3362,7 +3363,11 @@ eval7(
33623363
/*
33633364
* Dictionary: #{key: val, key: val}
33643365
*/
3365-
case '#': if (!in_vim9script() && (*arg)[1] == '{')
3366+
case '#': if (in_vim9script())
3367+
{
3368+
ret = vim9_bad_comment(*arg) ? FAIL : NOTDONE;
3369+
}
3370+
else if ((*arg)[1] == '{')
33663371
{
33673372
++*arg;
33683373
ret = eval_dict(arg, rettv, evalarg, TRUE);
@@ -6112,6 +6117,7 @@ get_echo_attr(void)
61126117
* ":execute expr1 ..." execute the result of an expression.
61136118
* ":echomsg expr1 ..." Print a message
61146119
* ":echoerr expr1 ..." Print an error
6120+
* ":echoconsole expr1 ..." Print a message on stdout
61156121
* Each gets spaces around each argument and a newline at the end for
61166122
* echo commands
61176123
*/
@@ -6189,6 +6195,11 @@ ex_execute(exarg_T *eap)
61896195
msg_attr(ga.ga_data, echo_attr);
61906196
out_flush();
61916197
}
6198+
else if (eap->cmdidx == CMD_echoconsole)
6199+
{
6200+
ui_write(ga.ga_data, (int)STRLEN(ga.ga_data), TRUE);
6201+
ui_write((char_u *)"\r\n", 2, TRUE);
6202+
}
61926203
else if (eap->cmdidx == CMD_echoerr)
61936204
{
61946205
int save_did_emsg = did_emsg;

src/evalfunc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7937,7 +7937,7 @@ f_screenstring(typval_T *argvars, typval_T *rettv)
79377937
c = ScreenLines[off];
79387938
buflen += mb_char2bytes(c, buf);
79397939

7940-
if (enc_utf8)
7940+
if (enc_utf8 && ScreenLinesUC[off] != 0)
79417941
for (i = 0; i < Screen_mco && ScreenLinesC[i][off] != 0; ++i)
79427942
buflen += mb_char2bytes(ScreenLinesC[i][off], buf + buflen);
79437943

src/evalwindow.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,18 +1007,25 @@ f_winnr(typval_T *argvars UNUSED, typval_T *rettv)
10071007
f_winrestcmd(typval_T *argvars UNUSED, typval_T *rettv)
10081008
{
10091009
win_T *wp;
1010-
int winnr = 1;
1010+
int i;
1011+
int winnr;
10111012
garray_T ga;
10121013
char_u buf[50];
10131014

10141015
ga_init2(&ga, (int)sizeof(char), 70);
1015-
FOR_ALL_WINDOWS(wp)
1016+
1017+
// Do this twice to handle some window layouts properly.
1018+
for (i = 0; i < 2; ++i)
10161019
{
1017-
sprintf((char *)buf, ":%dresize %d|", winnr, wp->w_height);
1018-
ga_concat(&ga, buf);
1019-
sprintf((char *)buf, "vert :%dresize %d|", winnr, wp->w_width);
1020-
ga_concat(&ga, buf);
1021-
++winnr;
1020+
winnr = 1;
1021+
FOR_ALL_WINDOWS(wp)
1022+
{
1023+
sprintf((char *)buf, ":%dresize %d|", winnr, wp->w_height);
1024+
ga_concat(&ga, buf);
1025+
sprintf((char *)buf, "vert :%dresize %d|", winnr, wp->w_width);
1026+
ga_concat(&ga, buf);
1027+
++winnr;
1028+
}
10221029
}
10231030
ga_append(&ga, NUL);
10241031

src/ex_cmdidxs.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ static const unsigned short cmdidxs1[26] =
1010
/* c */ 43,
1111
/* d */ 109,
1212
/* e */ 134,
13-
/* f */ 157,
14-
/* g */ 174,
15-
/* h */ 180,
16-
/* i */ 189,
17-
/* j */ 208,
18-
/* k */ 210,
19-
/* l */ 215,
20-
/* m */ 277,
21-
/* n */ 297,
22-
/* o */ 317,
23-
/* p */ 329,
24-
/* q */ 368,
25-
/* r */ 371,
26-
/* s */ 391,
27-
/* t */ 460,
28-
/* u */ 505,
29-
/* v */ 516,
30-
/* w */ 537,
31-
/* x */ 551,
32-
/* y */ 561,
33-
/* z */ 562
13+
/* f */ 158,
14+
/* g */ 175,
15+
/* h */ 181,
16+
/* i */ 190,
17+
/* j */ 209,
18+
/* k */ 211,
19+
/* l */ 216,
20+
/* m */ 278,
21+
/* n */ 298,
22+
/* o */ 318,
23+
/* p */ 330,
24+
/* q */ 369,
25+
/* r */ 372,
26+
/* s */ 392,
27+
/* t */ 461,
28+
/* u */ 506,
29+
/* v */ 517,
30+
/* w */ 538,
31+
/* x */ 552,
32+
/* y */ 562,
33+
/* z */ 563
3434
};
3535

3636
/*
@@ -45,7 +45,7 @@ static const unsigned char cmdidxs2[26][26] =
4545
/* b */ { 2, 0, 0, 5, 6, 8, 0, 0, 0, 0, 0, 9, 10, 11, 12, 13, 0, 14, 0, 0, 0, 0, 23, 0, 0, 0 },
4646
/* c */ { 3, 12, 16, 18, 20, 22, 25, 0, 0, 0, 0, 33, 37, 40, 46, 56, 58, 59, 60, 0, 62, 0, 65, 0, 0, 0 },
4747
/* d */ { 0, 0, 0, 0, 0, 0, 0, 0, 8, 18, 0, 19, 0, 0, 20, 0, 0, 22, 23, 0, 0, 0, 0, 0, 0, 0 },
48-
/* e */ { 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 10, 0, 0, 0, 0, 0, 0, 0, 17, 0, 18, 0, 0 },
48+
/* e */ { 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 8, 10, 11, 0, 0, 0, 0, 0, 0, 0, 18, 0, 19, 0, 0 },
4949
/* f */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0 },
5050
/* g */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 4, 5, 0, 0, 0, 0 },
5151
/* h */ { 5, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -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 = 577;
72+
static const int command_count = 578;

src/ex_cmds.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@ EXCMD(CMD_echohl, "echohl", ex_echohl,
530530
EXCMD(CMD_echomsg, "echomsg", ex_execute,
531531
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
532532
ADDR_NONE),
533+
EXCMD(CMD_echoconsole, "echoconsole", ex_execute,
534+
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
535+
ADDR_NONE),
533536
EXCMD(CMD_echon, "echon", ex_echo,
534537
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
535538
ADDR_NONE),

src/ex_docmd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5240,7 +5240,9 @@ ends_excmd2(char_u *cmd_start UNUSED, char_u *cmd)
52405240
return TRUE;
52415241
#ifdef FEAT_EVAL
52425242
if (in_vim9script())
5243-
return c == '#' && (cmd == cmd_start || VIM_ISWHITE(cmd[-1]));
5243+
// # starts a comment, #{ might be a mistake, #{{ can start a fold
5244+
return c == '#' && (cmd[1] != '{' || cmd[2] == '{')
5245+
&& (cmd == cmd_start || VIM_ISWHITE(cmd[-1]));
52445246
#endif
52455247
return c == '"';
52465248
}

0 commit comments

Comments
 (0)