Skip to content

Commit b3e08b3

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 7c1e936 + 885971e commit b3e08b3

Some content is hidden

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

54 files changed

+2320
-622
lines changed

runtime/doc/channel.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ available.
852852
job_getchannel({job}) *job_getchannel()*
853853
Get the channel handle that {job} is using.
854854
To check if the job has no channel: >
855-
if string(job_getchannel()) == 'channel fail'
855+
if string(job_getchannel(job)) == 'channel fail'
856856
<
857857
Can also be used as a |method|: >
858858
GetJob()->job_getchannel()

runtime/doc/options.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,10 @@ A jump table for the options with a short description can be found at |Q_op|.
13311331
continuation (positive).
13321332
sbr Display the 'showbreak' value before applying the
13331333
additional indent.
1334-
The default value for min is 20 and shift is 0.
1334+
list:{n} Adds an additional indent for lines that match a
1335+
numbered or bulleted list (using the
1336+
'formatlistpat' setting).
1337+
The default value for min is 20, shift and list is 0.
13351338

13361339
*'browsedir'* *'bsdir'*
13371340
'browsedir' 'bsdir' string (default: "last")

runtime/doc/vim9.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,9 @@ script file to avoid confusion.
13541354
`:import` can also be used in legacy Vim script. The imported items still
13551355
become script-local, even when the "s:" prefix is not given.
13561356

1357+
`:import` can not be used in a function. Imported items are intended to exist
1358+
at the script level and only imported once.
1359+
13571360
The script name after `import` can be:
13581361
- A relative path, starting "." or "..". This finds a file relative to the
13591362
location of the script file itself. This is useful to split up a large
@@ -1363,6 +1366,7 @@ The script name after `import` can be:
13631366
- A path not being relative or absolute. This will be found in the
13641367
"import" subdirectories of 'runtimepath' entries. The name will usually be
13651368
longer and unique, to avoid loading the wrong file.
1369+
Note that "after/import" is not used.
13661370

13671371
Once a vim9 script file has been imported, the result is cached and used the
13681372
next time the same script is imported. It will not be read again.

src/change.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,12 @@ changed_common(
563563
changed_cline_bef_curs_win(wp);
564564
if (wp->w_botline >= lnum)
565565
{
566-
// Assume that botline doesn't change (inserted lines make
567-
// other lines scroll down below botline).
568-
approximate_botline_win(wp);
566+
if (xtra < 0)
567+
invalidate_botline_win(wp);
568+
else
569+
// Assume that botline doesn't change (inserted lines make
570+
// other lines scroll down below botline).
571+
approximate_botline_win(wp);
569572
}
570573

571574
// Check if any w_lines[] entries have become invalid.

src/clientserver.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,15 @@ f_remote_read(typval_T *argvars UNUSED, typval_T *rettv)
896896
char_u *r = NULL;
897897

898898
#ifdef FEAT_CLIENTSERVER
899-
char_u *serverid = tv_get_string_chk(&argvars[0]);
899+
char_u *serverid;
900+
901+
if (in_vim9script()
902+
&& (check_for_string_arg(argvars, 0) == FAIL
903+
|| (argvars[1].v_type != VAR_UNKNOWN
904+
&& check_for_number_arg(argvars, 1) == FAIL)))
905+
return;
900906

907+
serverid = tv_get_string_chk(&argvars[0]);
901908
if (serverid != NULL && !check_restricted() && !check_secure())
902909
{
903910
int timeout = 0;

src/cmdhist.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,12 @@ f_histget(typval_T *argvars UNUSED, typval_T *rettv)
597597
int idx;
598598
char_u *str;
599599

600+
if (in_vim9script()
601+
&& (check_for_string_arg(argvars, 0) == FAIL
602+
|| (argvars[1].v_type != VAR_UNKNOWN
603+
&& check_for_number_arg(argvars, 1) == FAIL)))
604+
return;
605+
600606
str = tv_get_string_chk(&argvars[0]); // NULL on type error
601607
if (str == NULL)
602608
rettv->vval.v_string = NULL;

src/diff.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3283,7 +3283,7 @@ f_diff_filler(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
32833283
f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
32843284
{
32853285
#ifdef FEAT_DIFF
3286-
linenr_T lnum = tv_get_lnum(argvars);
3286+
linenr_T lnum;
32873287
static linenr_T prev_lnum = 0;
32883288
static varnumber_T changedtick = 0;
32893289
static int fnum = 0;
@@ -3293,6 +3293,14 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
32933293
int filler_lines;
32943294
int col;
32953295

3296+
if (in_vim9script()
3297+
&& ((argvars[0].v_type != VAR_STRING
3298+
&& argvars[0].v_type != VAR_NUMBER
3299+
&& check_for_string_arg(argvars, 0) == FAIL)
3300+
|| check_for_number_arg(argvars, 1) == FAIL))
3301+
return;
3302+
3303+
lnum = tv_get_lnum(argvars);
32963304
if (lnum < 0) // ignore type error in {lnum} arg
32973305
lnum = 0;
32983306
if (lnum != prev_lnum

src/dosinst.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,7 @@ install_registry(void)
15801580
char display_name[BUFSIZE];
15811581
char uninstall_string[BUFSIZE];
15821582
char icon_string[BUFSIZE];
1583+
char version_string[BUFSIZE];
15831584
int i;
15841585
int loop_count = is_64bit_os() ? 2 : 1;
15851586
DWORD flag;
@@ -1652,13 +1653,15 @@ install_registry(void)
16521653

16531654
sprintf(icon_string, "%s\\gvim.exe,0", installdir);
16541655

1656+
sprintf(version_string, VIM_VERSION_SHORT "." VIM_VERSION_PATCHLEVEL_STR);
1657+
16551658
lRet = register_uninstall(
16561659
HKEY_LOCAL_MACHINE,
16571660
"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT,
16581661
display_name,
16591662
uninstall_string,
16601663
icon_string,
1661-
VIM_VERSION_SHORT,
1664+
version_string,
16621665
"Bram Moolenaar et al.");
16631666
if (ERROR_SUCCESS != lRet)
16641667
return FAIL;

src/errors.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ EXTERN char e_mismatched_endfunction[]
381381
INIT(= N_("E1151: Mismatched endfunction"));
382382
EXTERN char e_mismatched_enddef[]
383383
INIT(= N_("E1152: Mismatched enddef"));
384-
EXTERN char e_invalid_operation_for_bool[]
385-
INIT(= N_("E1153: Invalid operation for bool"));
384+
EXTERN char e_invalid_operation_for_str[]
385+
INIT(= N_("E1153: Invalid operation for %s"));
386386
EXTERN char e_divide_by_zero[]
387387
INIT(= N_("E1154: Divide by zero"));
388388
EXTERN char e_cannot_define_autocommands_for_all_events[]
@@ -496,3 +496,15 @@ EXTERN char e_dict_required_for_argument_nr[]
496496
INIT(= N_("E1206: Dictionary required for argument %d"));
497497
EXTERN char e_expression_without_effect_str[]
498498
INIT(= N_("E1207: Expression without an effect: %s"));
499+
EXTERN char e_complete_used_without_nargs[]
500+
INIT(= N_("E1208: -complete used without -nargs"));
501+
EXTERN char e_invalid_value_for_line_number_str[]
502+
INIT(= N_("E1209: Invalid value for a line number: \"%s\""));
503+
EXTERN char e_number_required_for_argument_nr[]
504+
INIT(= N_("E1210: Number required for argument %d"));
505+
EXTERN char e_list_required_for_argument_nr[]
506+
INIT(= N_("E1211: List required for argument %d"));
507+
EXTERN char e_bool_required_for_argument_nr[]
508+
INIT(= N_("E1211: Bool required for argument %d"));
509+
EXTERN char e_redefining_imported_item_str[]
510+
INIT(= N_("E1212: Redefining imported item %s"));

src/eval.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,8 @@ set_var_lval(
13581358
|| (!var_check_ro(di->di_flags, lp->ll_name, FALSE)
13591359
&& !tv_check_lock(&di->di_tv, lp->ll_name, FALSE)))
13601360
&& tv_op(&tv, rettv, op) == OK)
1361-
set_var(lp->ll_name, &tv, FALSE);
1361+
set_var_const(lp->ll_name, NULL, &tv, FALSE,
1362+
ASSIGN_NO_DECL, 0);
13621363
clear_tv(&tv);
13631364
}
13641365
}
@@ -1784,6 +1785,8 @@ next_for_item(void *fi_void, char_u *arg)
17841785
| ASSIGN_NO_MEMBER_TYPE)
17851786
: 0);
17861787
listitem_T *item;
1788+
int skip_assign = in_vim9script() && arg[0] == '_'
1789+
&& !eval_isnamec(arg[1]);
17871790

17881791
if (fi->fi_blob != NULL)
17891792
{
@@ -1795,6 +1798,8 @@ next_for_item(void *fi_void, char_u *arg)
17951798
tv.v_lock = VAR_FIXED;
17961799
tv.vval.v_number = blob_get(fi->fi_blob, fi->fi_bi);
17971800
++fi->fi_bi;
1801+
if (skip_assign)
1802+
return TRUE;
17981803
return ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon,
17991804
fi->fi_varcount, flag, NULL) == OK;
18001805
}
@@ -1812,7 +1817,10 @@ next_for_item(void *fi_void, char_u *arg)
18121817
tv.vval.v_string = vim_strnsave(fi->fi_string + fi->fi_byte_idx, len);
18131818
fi->fi_byte_idx += len;
18141819
++fi->fi_bi;
1815-
result = ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon,
1820+
if (skip_assign)
1821+
result = TRUE;
1822+
else
1823+
result = ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon,
18161824
fi->fi_varcount, flag, NULL) == OK;
18171825
vim_free(tv.vval.v_string);
18181826
return result;
@@ -1825,7 +1833,10 @@ next_for_item(void *fi_void, char_u *arg)
18251833
{
18261834
fi->fi_lw.lw_item = item->li_next;
18271835
++fi->fi_bi;
1828-
result = (ex_let_vars(arg, &item->li_tv, TRUE, fi->fi_semicolon,
1836+
if (skip_assign)
1837+
result = TRUE;
1838+
else
1839+
result = (ex_let_vars(arg, &item->li_tv, TRUE, fi->fi_semicolon,
18291840
fi->fi_varcount, flag, NULL) == OK);
18301841
}
18311842
return result;
@@ -2177,6 +2188,11 @@ eval_next_line(evalarg_T *evalarg)
21772188
vim_free(evalarg->eval_tofree);
21782189
evalarg->eval_tofree = line;
21792190
}
2191+
2192+
// Advanced to the next line, "arg" no longer points into the previous
2193+
// line.
2194+
VIM_CLEAR(evalarg->eval_tofree_cmdline);
2195+
21802196
return skipwhite(line);
21812197
}
21822198

@@ -5376,6 +5392,8 @@ var2fpos(
53765392
}
53775393
return &pos;
53785394
}
5395+
if (in_vim9script())
5396+
semsg(_(e_invalid_value_for_line_number_str), name);
53795397
return NULL;
53805398
}
53815399

@@ -6189,6 +6207,7 @@ ex_execute(exarg_T *eap)
61896207
char_u *p;
61906208
garray_T ga;
61916209
int len;
6210+
long start_lnum = SOURCING_LNUM;
61926211

61936212
ga_init2(&ga, 1, 80);
61946213

@@ -6242,6 +6261,9 @@ ex_execute(exarg_T *eap)
62426261

62436262
if (ret != FAIL && ga.ga_data != NULL)
62446263
{
6264+
// use the first line of continuation lines for messages
6265+
SOURCING_LNUM = start_lnum;
6266+
62456267
if (eap->cmdidx == CMD_echomsg || eap->cmdidx == CMD_echoerr)
62466268
{
62476269
// Mark the already saved text as finishing the line, so that what

0 commit comments

Comments
 (0)