Skip to content

Commit c0d5f05

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 9f2b9b3 + 509695c commit c0d5f05

Some content is hidden

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

45 files changed

+512
-263
lines changed

runtime/doc/testing.txt

+10
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ test_gui_event({event}, {args})
9494
"findrepl" search and replace text.
9595
"mouse" mouse button click event.
9696
"scrollbar" move or drag the scrollbar.
97+
"sendevent" send a low-level GUI event.
9798
"tabline" select a tab page by mouse click.
9899
"tabmenu" select a tabline menu entry.
99100

@@ -177,6 +178,15 @@ test_gui_event({event}, {args})
177178
dragging: 1 to drag the scrollbar and 0 to click in the
178179
scrollbar.
179180

181+
"sendevent":
182+
Send a low-level GUI event (e.g. key-up or down).
183+
Currently only supported on MS-Windows.
184+
The supported items in {args} are:
185+
event: The supported string values are:
186+
keyup generate a keyup event
187+
keydown generate a keydown event
188+
keycode: Keycode to use for a keyup or a keydown event.
189+
180190
"tabline":
181191
Inject a mouse click event on the tabline to select a
182192
tabpage. The supported items in {args} are:

src/auto/configure

+20-13
Original file line numberDiff line numberDiff line change
@@ -13295,13 +13295,14 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1329513295

1329613296
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for timer_create" >&5
1329713297
$as_echo_n "checking for timer_create... " >&6; }
13298-
save_LIBS="$LIBS"
13298+
if ${vim_cv_timer_create+:} false; then :
13299+
$as_echo_n "(cached) " >&6
13300+
else
13301+
save_LIBS="$LIBS"
1329913302
LIBS="$LIBS -lrt"
1330013303
if test "$cross_compiling" = yes; then :
13301-
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
13302-
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
13303-
as_fn_error $? "cannot run test program while cross compiling
13304-
See \`config.log' for more details" "$LINENO" 5; }
13304+
as_fn_error $? "cross-compiling: please set 'vim_cv_timer_create'" "$LINENO" 5
13305+
1330513306
else
1330613307
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1330713308
/* end confdefs.h. */
@@ -13328,9 +13329,8 @@ main ()
1332813329
}
1332913330
_ACEOF
1333013331
if ac_fn_c_try_run "$LINENO"; then :
13331-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes; with -lrt" >&5
13332-
$as_echo "yes; with -lrt" >&6; }; $as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h
13333-
13332+
{ $as_echo "$as_me:${as_lineno-$LINENO}: timer_create with -lrt" >&5
13333+
$as_echo "$as_me: timer_create with -lrt" >&6;}; vim_cv_timer_create=yes
1333413334
else
1333513335
LIBS="$save_LIBS"
1333613336
if test "$cross_compiling" = yes; then :
@@ -13364,12 +13364,9 @@ main ()
1336413364
}
1336513365
_ACEOF
1336613366
if ac_fn_c_try_run "$LINENO"; then :
13367-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
13368-
$as_echo "yes" >&6; }; $as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h
13369-
13367+
vim_cv_timer_create=yes
1337013368
else
13371-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
13372-
$as_echo "no" >&6; }
13369+
vim_cv_timer_create=no
1337313370
fi
1337413371
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
1337513372
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -13381,6 +13378,16 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
1338113378
fi
1338213379

1338313380

13381+
fi
13382+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vim_cv_timer_create" >&5
13383+
$as_echo "$vim_cv_timer_create" >&6; }
13384+
13385+
if test "x$vim_cv_timer_create" = "xyes" ; then
13386+
$as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h
13387+
13388+
fi
13389+
13390+
1338413391
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat() ignores a trailing slash" >&5
1338513392
$as_echo_n "checking whether stat() ignores a trailing slash... " >&6; }
1338613393
if ${vim_cv_stat_ignores_slash+:} false; then :

src/autocmd.c

+14-13
Original file line numberDiff line numberDiff line change
@@ -2210,9 +2210,13 @@ apply_autocmds_group(
22102210
ap->last = FALSE;
22112211
ap->last = TRUE;
22122212

2213+
// Make sure cursor and topline are valid. The first time the current
2214+
// values are saved, restored by reset_lnums(). When nested only the
2215+
// values are corrected when needed.
22132216
if (nesting == 1)
2214-
// make sure cursor and topline are valid
22152217
check_lnums(TRUE);
2218+
else
2219+
check_lnums_nested(TRUE);
22162220

22172221
save_did_emsg = did_emsg;
22182222

@@ -2830,7 +2834,7 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
28302834
}
28312835
}
28322836

2833-
group_name = dict_get_string(event_dict, (char_u *)"group", TRUE);
2837+
group_name = dict_get_string(event_dict, "group", TRUE);
28342838
if (group_name == NULL || *group_name == NUL)
28352839
// if the autocmd group name is not specified, then use the current
28362840
// autocmd group
@@ -2865,7 +2869,7 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
28652869
{
28662870
varnumber_T bnum;
28672871

2868-
bnum = dict_get_number_def(event_dict, (char_u *)"bufnr", -1);
2872+
bnum = dict_get_number_def(event_dict, "bufnr", -1);
28692873
if (bnum == -1)
28702874
continue;
28712875

@@ -2905,13 +2909,13 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
29052909
pat = (char_u *)"";
29062910
}
29072911

2908-
once = dict_get_bool(event_dict, (char_u *)"once", FALSE);
2909-
nested = dict_get_bool(event_dict, (char_u *)"nested", FALSE);
2912+
once = dict_get_bool(event_dict, "once", FALSE);
2913+
nested = dict_get_bool(event_dict, "nested", FALSE);
29102914
// if 'replace' is true, then remove all the commands associated with
29112915
// this autocmd event/group and add the new command.
2912-
replace = dict_get_bool(event_dict, (char_u *)"replace", FALSE);
2916+
replace = dict_get_bool(event_dict, "replace", FALSE);
29132917

2914-
cmd = dict_get_string(event_dict, (char_u *)"cmd", TRUE);
2918+
cmd = dict_get_string(event_dict, "cmd", TRUE);
29152919
if (cmd == NULL)
29162920
{
29172921
if (delete)
@@ -3073,8 +3077,7 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
30733077
// return only the autocmds in the specified group
30743078
if (dict_has_key(argvars[0].vval.v_dict, "group"))
30753079
{
3076-
name = dict_get_string(argvars[0].vval.v_dict,
3077-
(char_u *)"group", TRUE);
3080+
name = dict_get_string(argvars[0].vval.v_dict, "group", TRUE);
30783081
if (name == NULL)
30793082
return;
30803083

@@ -3098,8 +3101,7 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
30983101
{
30993102
int i;
31003103

3101-
name = dict_get_string(argvars[0].vval.v_dict,
3102-
(char_u *)"event", TRUE);
3104+
name = dict_get_string(argvars[0].vval.v_dict, "event", TRUE);
31033105
if (name == NULL)
31043106
return;
31053107

@@ -3124,8 +3126,7 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
31243126
// return only the autocmds for the specified pattern
31253127
if (dict_has_key(argvars[0].vval.v_dict, "pattern"))
31263128
{
3127-
pat = dict_get_string(argvars[0].vval.v_dict,
3128-
(char_u *)"pattern", TRUE);
3129+
pat = dict_get_string(argvars[0].vval.v_dict, "pattern", TRUE);
31293130
if (pat == NULL)
31303131
return;
31313132
}

src/change.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ check_recorded_changes(
172172
FOR_ALL_LIST_ITEMS(buf->b_recorded_changes, li)
173173
{
174174
prev_lnum = (linenr_T)dict_get_number(
175-
li->li_tv.vval.v_dict, (char_u *)"lnum");
175+
li->li_tv.vval.v_dict, "lnum");
176176
prev_lnume = (linenr_T)dict_get_number(
177-
li->li_tv.vval.v_dict, (char_u *)"end");
177+
li->li_tv.vval.v_dict, "end");
178178
if (prev_lnum >= lnum || prev_lnum > lnume || prev_lnume >= lnum)
179179
{
180180
// the current change is going to make the line number in
@@ -384,13 +384,13 @@ invoke_listeners(buf_T *buf)
384384
{
385385
varnumber_T lnum;
386386

387-
lnum = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"lnum");
387+
lnum = dict_get_number(li->li_tv.vval.v_dict, "lnum");
388388
if (start > lnum)
389389
start = lnum;
390-
lnum = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"end");
390+
lnum = dict_get_number(li->li_tv.vval.v_dict, "end");
391391
if (end < lnum)
392392
end = lnum;
393-
added += dict_get_number(li->li_tv.vval.v_dict, (char_u *)"added");
393+
added += dict_get_number(li->li_tv.vval.v_dict, "added");
394394
}
395395
argv[1].v_type = VAR_NUMBER;
396396
argv[1].vval.v_number = start;

src/configure.ac

+12-4
Original file line numberDiff line numberDiff line change
@@ -4004,7 +4004,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
40044004
dnl Check for timer_create. It probably requires the 'rt' library.
40054005
dnl Run the program to find out if timer_create(CLOCK_MONOTONIC) actually
40064006
dnl works, on Solaris timer_create() exists but fails at runtime.
4007-
AC_MSG_CHECKING([for timer_create])
4007+
AC_CACHE_CHECK([for timer_create], [vim_cv_timer_create],
40084008
save_LIBS="$LIBS"
40094009
LIBS="$LIBS -lrt"
40104010
AC_RUN_IFELSE([AC_LANG_PROGRAM([
@@ -4021,7 +4021,7 @@ static void set_flag(union sigval sv) {}
40214021
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
40224022
exit(1); // cannot create a monotonic timer
40234023
])],
4024-
AC_MSG_RESULT(yes; with -lrt); AC_DEFINE(HAVE_TIMER_CREATE),
4024+
AC_MSG_NOTICE(timer_create with -lrt); vim_cv_timer_create=yes,
40254025
LIBS="$save_LIBS"
40264026
AC_RUN_IFELSE([AC_LANG_PROGRAM([
40274027
#include<signal.h>
@@ -4037,8 +4037,16 @@ static void set_flag(union sigval sv) {}
40374037
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
40384038
exit(1); // cannot create a monotonic timer
40394039
])],
4040-
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMER_CREATE),
4041-
AC_MSG_RESULT(no)))
4040+
vim_cv_timer_create=yes,
4041+
vim_cv_timer_create=no),
4042+
AC_MSG_ERROR(cross-compiling: please set 'vim_cv_timer_create')
4043+
)
4044+
)
4045+
4046+
if test "x$vim_cv_timer_create" = "xyes" ; then
4047+
AC_DEFINE(HAVE_TIMER_CREATE)
4048+
fi
4049+
40424050

40434051
AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
40444052
[

src/dict.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -662,11 +662,11 @@ dict_has_key(dict_T *d, char *key)
662662
* Returns FAIL if the entry doesn't exist or out of memory.
663663
*/
664664
int
665-
dict_get_tv(dict_T *d, char_u *key, typval_T *rettv)
665+
dict_get_tv(dict_T *d, char *key, typval_T *rettv)
666666
{
667667
dictitem_T *di;
668668

669-
di = dict_find(d, key, -1);
669+
di = dict_find(d, (char_u *)key, -1);
670670
if (di == NULL)
671671
return FAIL;
672672
copy_tv(&di->di_tv, rettv);
@@ -680,12 +680,12 @@ dict_get_tv(dict_T *d, char_u *key, typval_T *rettv)
680680
* Returns NULL if the entry doesn't exist or out of memory.
681681
*/
682682
char_u *
683-
dict_get_string(dict_T *d, char_u *key, int save)
683+
dict_get_string(dict_T *d, char *key, int save)
684684
{
685685
dictitem_T *di;
686686
char_u *s;
687687

688-
di = dict_find(d, key, -1);
688+
di = dict_find(d, (char_u *)key, -1);
689689
if (di == NULL)
690690
return NULL;
691691
s = tv_get_string(&di->di_tv);
@@ -699,7 +699,7 @@ dict_get_string(dict_T *d, char_u *key, int save)
699699
* Returns 0 if the entry doesn't exist.
700700
*/
701701
varnumber_T
702-
dict_get_number(dict_T *d, char_u *key)
702+
dict_get_number(dict_T *d, char *key)
703703
{
704704
return dict_get_number_def(d, key, 0);
705705
}
@@ -709,11 +709,11 @@ dict_get_number(dict_T *d, char_u *key)
709709
* Returns "def" if the entry doesn't exist.
710710
*/
711711
varnumber_T
712-
dict_get_number_def(dict_T *d, char_u *key, int def)
712+
dict_get_number_def(dict_T *d, char *key, int def)
713713
{
714714
dictitem_T *di;
715715

716-
di = dict_find(d, key, -1);
716+
di = dict_find(d, (char_u *)key, -1);
717717
if (di == NULL)
718718
return def;
719719
return tv_get_number(&di->di_tv);
@@ -745,11 +745,11 @@ dict_get_number_check(dict_T *d, char_u *key)
745745
* Returns "def" if the entry doesn't exist.
746746
*/
747747
varnumber_T
748-
dict_get_bool(dict_T *d, char_u *key, int def)
748+
dict_get_bool(dict_T *d, char *key, int def)
749749
{
750750
dictitem_T *di;
751751

752-
di = dict_find(d, key, -1);
752+
di = dict_find(d, (char_u *)key, -1);
753753
if (di == NULL)
754754
return def;
755755
return tv_get_bool(&di->di_tv);

src/errors.h

+6
Original file line numberDiff line numberDiff line change
@@ -3308,4 +3308,10 @@ EXTERN char e_could_not_check_for_pending_sigalrm_str[]
33083308
#ifdef FEAT_EVAL
33093309
EXTERN char e_substitute_nesting_too_deep[]
33103310
INIT(= N_("E1290: substitute nesting too deep"));
3311+
EXTERN char e_invalid_argument_nr[]
3312+
INIT(= N_("E1291: Invalid argument: %ld"));
3313+
#endif
3314+
#ifdef FEAT_CMDWIN
3315+
EXTERN char e_cmdline_window_already_open[]
3316+
INIT(= N_("E1292: Command-line window is already open"));
33113317
#endif

src/evalbuffer.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -695,9 +695,9 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv)
695695
if (sel_d != NULL)
696696
{
697697
filtered = TRUE;
698-
sel_buflisted = dict_get_bool(sel_d, (char_u *)"buflisted", FALSE);
699-
sel_bufloaded = dict_get_bool(sel_d, (char_u *)"bufloaded", FALSE);
700-
sel_bufmodified = dict_get_bool(sel_d, (char_u *)"bufmodified",
698+
sel_buflisted = dict_get_bool(sel_d, "buflisted", FALSE);
699+
sel_bufloaded = dict_get_bool(sel_d, "bufloaded", FALSE);
700+
sel_bufmodified = dict_get_bool(sel_d, "bufmodified",
701701
FALSE);
702702
}
703703
}

src/evalfunc.c

+5-6
Original file line numberDiff line numberDiff line change
@@ -4217,8 +4217,7 @@ f_expandcmd(typval_T *argvars, typval_T *rettv)
42174217
return;
42184218

42194219
if (argvars[1].v_type == VAR_DICT
4220-
&& dict_get_bool(argvars[1].vval.v_dict, (char_u *)"errmsg",
4221-
VVAL_FALSE))
4220+
&& dict_get_bool(argvars[1].vval.v_dict, "errmsg", VVAL_FALSE))
42224221
emsgoff = FALSE;
42234222

42244223
rettv->v_type = VAR_STRING;
@@ -9207,7 +9206,7 @@ f_setcharsearch(typval_T *argvars, typval_T *rettv UNUSED)
92079206

92089207
if ((d = argvars[0].vval.v_dict) != NULL)
92099208
{
9210-
csearch = dict_get_string(d, (char_u *)"char", FALSE);
9209+
csearch = dict_get_string(d, "char", FALSE);
92119210
if (csearch != NULL)
92129211
{
92139212
if (enc_utf8)
@@ -9403,7 +9402,7 @@ f_setreg(typval_T *argvars, typval_T *rettv)
94039402
if (di != NULL)
94049403
regcontents = &di->di_tv;
94059404

9406-
stropt = dict_get_string(d, (char_u *)"regtype", FALSE);
9405+
stropt = dict_get_string(d, "regtype", FALSE);
94079406
if (stropt != NULL)
94089407
{
94099408
int ret = get_yank_type(&stropt, &yank_type, &block_len);
@@ -9417,14 +9416,14 @@ f_setreg(typval_T *argvars, typval_T *rettv)
94179416

94189417
if (regname == '"')
94199418
{
9420-
stropt = dict_get_string(d, (char_u *)"points_to", FALSE);
9419+
stropt = dict_get_string(d, "points_to", FALSE);
94219420
if (stropt != NULL)
94229421
{
94239422
pointreg = *stropt;
94249423
regname = pointreg;
94259424
}
94269425
}
9427-
else if (dict_get_bool(d, (char_u *)"isunnamed", -1) > 0)
9426+
else if (dict_get_bool(d, "isunnamed", -1) > 0)
94289427
pointreg = regname;
94299428
}
94309429
else

0 commit comments

Comments
 (0)