Skip to content

Commit 1be6353

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents cadc237 + 683581e commit 1be6353

50 files changed

Lines changed: 2495 additions & 1333 deletions

Some content is hidden

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

.github/workflows/ci-windows.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: GitHub CI
33
on:
44
push:
55
branches:
6-
- '*'
6+
- '**'
77
pull_request:
88

99
env:
@@ -39,6 +39,7 @@ jobs:
3939
runs-on: windows-latest
4040

4141
strategy:
42+
fail-fast: false
4243
matrix:
4344
toolchain: [msvc, mingw]
4445
arch: [x64, x86]

runtime/doc/autocmd.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,9 +883,14 @@ InsertEnter Just before starting Insert mode. Also for
883883
The cursor is restored afterwards. If you do
884884
not want that set |v:char| to a non-empty
885885
string.
886+
*InsertLeavePre*
887+
InsertLeavePre Just before leaving Insert mode. Also when
888+
using CTRL-O |i_CTRL-O|. Be caseful not to
889+
change mode or use `:normal`, it will likely
890+
cause trouble.
886891
*InsertLeave*
887-
InsertLeave When leaving Insert mode. Also when using
888-
CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
892+
InsertLeave Just after leaving Insert mode. Also when
893+
using CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
889894
*MenuPopup*
890895
MenuPopup Just before showing the popup menu (under the
891896
right mouse button). Useful for adjusting the

src/autocmd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ static struct event_name
149149
{"InsertChange", EVENT_INSERTCHANGE},
150150
{"InsertEnter", EVENT_INSERTENTER},
151151
{"InsertLeave", EVENT_INSERTLEAVE},
152+
{"InsertLeavePre", EVENT_INSERTLEAVEPRE},
152153
{"InsertCharPre", EVENT_INSERTCHARPRE},
153154
{"MenuPopup", EVENT_MENUPOPUP},
154155
{"OptionSet", EVENT_OPTIONSET},

src/blob.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ blob_copy(blob_T *from, typval_T *to)
8080
len = 0;
8181
}
8282
to->vval.v_blob->bv_ga.ga_len = len;
83+
to->vval.v_blob->bv_ga.ga_maxlen = len;
8384
}
8485
return ret;
8586
}

src/dict.c

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -860,13 +860,10 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
860860
*arg = skipwhite(*arg);
861861
if (**arg != ':')
862862
{
863-
if (evaluate)
864-
{
865-
if (*skipwhite(*arg) == ':')
866-
semsg(_(e_no_white_space_allowed_before_str), ":");
867-
else
868-
semsg(_(e_missing_dict_colon), *arg);
869-
}
863+
if (*skipwhite(*arg) == ':')
864+
semsg(_(e_no_white_space_allowed_before_str), ":");
865+
else
866+
semsg(_(e_missing_dict_colon), *arg);
870867
clear_tv(&tvkey);
871868
goto failret;
872869
}
@@ -899,8 +896,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
899896
item = dict_find(d, key, -1);
900897
if (item != NULL)
901898
{
902-
if (evaluate)
903-
semsg(_(e_duplicate_key), key);
899+
semsg(_(e_duplicate_key), key);
904900
clear_tv(&tvkey);
905901
clear_tv(&tv);
906902
goto failret;
@@ -937,28 +933,24 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
937933
break;
938934
if (!had_comma)
939935
{
940-
if (evaluate)
941-
{
942-
if (**arg == ',')
943-
semsg(_(e_no_white_space_allowed_before_str), ",");
944-
else
945-
semsg(_(e_missing_dict_comma), *arg);
946-
}
936+
if (**arg == ',')
937+
semsg(_(e_no_white_space_allowed_before_str), ",");
938+
else
939+
semsg(_(e_missing_dict_comma), *arg);
947940
goto failret;
948941
}
949942
}
950943

951944
if (**arg != '}')
952945
{
953-
if (evaluate)
954-
semsg(_(e_missing_dict_end), *arg);
946+
semsg(_(e_missing_dict_end), *arg);
955947
failret:
956948
if (d != NULL)
957949
dict_free(d);
958950
return FAIL;
959951
}
960952

961-
*arg = skipwhite(*arg + 1);
953+
*arg = *arg + 1;
962954
if (evaluate)
963955
rettv_dict_set(rettv, d);
964956

src/edit.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3616,6 +3616,9 @@ ins_esc(
36163616
undisplay_dollar();
36173617
}
36183618

3619+
if (cmdchar != 'r' && cmdchar != 'v')
3620+
ins_apply_autocmds(EVENT_INSERTLEAVEPRE);
3621+
36193622
// When an autoindent was removed, curswant stays after the
36203623
// indent
36213624
if (restart_edit == NUL && (colnr_T)temp == curwin->w_cursor.col)

src/errors.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,8 @@ EXTERN char e_endblock_without_block[]
282282
INIT(= N_("E1128: } without {"));
283283
EXTERN char e_throw_with_empty_string[]
284284
INIT(= N_("E1129: Throw with empty string"));
285+
EXTERN char e_cannot_add_to_null_list[]
286+
INIT(= N_("E1130: Cannot add to null list"));
287+
EXTERN char e_cannot_add_to_null_blob[]
288+
INIT(= N_("E1131: Cannot add to null blob"));
285289
#endif

src/eval.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,12 @@ eval_to_string_skip(
368368
* Return FAIL for an error, OK otherwise.
369369
*/
370370
int
371-
skip_expr(char_u **pp)
371+
skip_expr(char_u **pp, evalarg_T *evalarg)
372372
{
373373
typval_T rettv;
374374

375375
*pp = skipwhite(*pp);
376-
return eval1(pp, &rettv, NULL);
376+
return eval1(pp, &rettv, evalarg);
377377
}
378378

379379
/*
@@ -2679,6 +2679,9 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
26792679
return OK;
26802680
}
26812681

2682+
/*
2683+
* Make a copy of blob "tv1" and append blob "tv2".
2684+
*/
26822685
void
26832686
eval_addblob(typval_T *tv1, typval_T *tv2)
26842687
{
@@ -2699,6 +2702,9 @@ eval_addblob(typval_T *tv1, typval_T *tv2)
26992702
}
27002703
}
27012704

2705+
/*
2706+
* Make a copy of list "tv1" and append list "tv2".
2707+
*/
27022708
int
27032709
eval_addlist(typval_T *tv1, typval_T *tv2)
27042710
{
@@ -2777,16 +2783,20 @@ eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
27772783
#ifdef FEAT_FLOAT
27782784
&& (op == '.' || rettv->v_type != VAR_FLOAT)
27792785
#endif
2780-
)
2786+
&& evaluate)
27812787
{
2788+
int error = FALSE;
2789+
27822790
// For "list + ...", an illegal use of the first operand as
27832791
// a number cannot be determined before evaluating the 2nd
27842792
// operand: if this is also a list, all is ok.
27852793
// For "something . ...", "something - ..." or "non-list + ...",
27862794
// we know that the first operand needs to be a string or number
27872795
// without evaluating the 2nd operand. So check before to avoid
27882796
// side effects after an error.
2789-
if (evaluate && tv_get_string_chk(rettv) == NULL)
2797+
if (op != '.')
2798+
tv_get_number_chk(rettv, &error);
2799+
if ((op == '.' && tv_get_string_chk(rettv) == NULL) || error)
27902800
{
27912801
clear_tv(rettv);
27922802
return FAIL;

src/evalbuffer.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -717,17 +717,19 @@ get_buffer_lines(
717717
void
718718
f_getbufline(typval_T *argvars, typval_T *rettv)
719719
{
720-
linenr_T lnum;
721-
linenr_T end;
720+
linenr_T lnum = 1;
721+
linenr_T end = 1;
722722
buf_T *buf;
723723

724724
buf = tv_get_buf_from_arg(&argvars[0]);
725-
726-
lnum = tv_get_lnum_buf(&argvars[1], buf);
727-
if (argvars[2].v_type == VAR_UNKNOWN)
728-
end = lnum;
729-
else
730-
end = tv_get_lnum_buf(&argvars[2], buf);
725+
if (buf != NULL)
726+
{
727+
lnum = tv_get_lnum_buf(&argvars[1], buf);
728+
if (argvars[2].v_type == VAR_UNKNOWN)
729+
end = lnum;
730+
else
731+
end = tv_get_lnum_buf(&argvars[2], buf);
732+
}
731733

732734
get_buffer_lines(buf, lnum, end, TRUE, rettv);
733735
}

0 commit comments

Comments
 (0)