Skip to content

Commit

Permalink
Merge remote-tracking branch 'vim/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ychin committed Jul 25, 2022
2 parents 9f2b9b3 + 509695c commit c0d5f05
Show file tree
Hide file tree
Showing 45 changed files with 512 additions and 263 deletions.
10 changes: 10 additions & 0 deletions runtime/doc/testing.txt
Expand Up @@ -94,6 +94,7 @@ test_gui_event({event}, {args})
"findrepl" search and replace text.
"mouse" mouse button click event.
"scrollbar" move or drag the scrollbar.
"sendevent" send a low-level GUI event.
"tabline" select a tab page by mouse click.
"tabmenu" select a tabline menu entry.

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

"sendevent":
Send a low-level GUI event (e.g. key-up or down).
Currently only supported on MS-Windows.
The supported items in {args} are:
event: The supported string values are:
keyup generate a keyup event
keydown generate a keydown event
keycode: Keycode to use for a keyup or a keydown event.

"tabline":
Inject a mouse click event on the tabline to select a
tabpage. The supported items in {args} are:
Expand Down
33 changes: 20 additions & 13 deletions src/auto/configure
Expand Up @@ -13295,13 +13295,14 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for timer_create" >&5
$as_echo_n "checking for timer_create... " >&6; }
save_LIBS="$LIBS"
if ${vim_cv_timer_create+:} false; then :
$as_echo_n "(cached) " >&6
else
save_LIBS="$LIBS"
LIBS="$LIBS -lrt"
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
as_fn_error $? "cross-compiling: please set 'vim_cv_timer_create'" "$LINENO" 5

else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Expand All @@ -13328,9 +13329,8 @@ main ()
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes; with -lrt" >&5
$as_echo "yes; with -lrt" >&6; }; $as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h

{ $as_echo "$as_me:${as_lineno-$LINENO}: timer_create with -lrt" >&5
$as_echo "$as_me: timer_create with -lrt" >&6;}; vim_cv_timer_create=yes
else
LIBS="$save_LIBS"
if test "$cross_compiling" = yes; then :
Expand Down Expand Up @@ -13364,12 +13364,9 @@ main ()
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }; $as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h

vim_cv_timer_create=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
vim_cv_timer_create=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
Expand All @@ -13381,6 +13378,16 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
fi


fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vim_cv_timer_create" >&5
$as_echo "$vim_cv_timer_create" >&6; }

if test "x$vim_cv_timer_create" = "xyes" ; then
$as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h

fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat() ignores a trailing slash" >&5
$as_echo_n "checking whether stat() ignores a trailing slash... " >&6; }
if ${vim_cv_stat_ignores_slash+:} false; then :
Expand Down
27 changes: 14 additions & 13 deletions src/autocmd.c
Expand Up @@ -2210,9 +2210,13 @@ apply_autocmds_group(
ap->last = FALSE;
ap->last = TRUE;

// Make sure cursor and topline are valid. The first time the current
// values are saved, restored by reset_lnums(). When nested only the
// values are corrected when needed.
if (nesting == 1)
// make sure cursor and topline are valid
check_lnums(TRUE);
else
check_lnums_nested(TRUE);

save_did_emsg = did_emsg;

Expand Down Expand Up @@ -2830,7 +2834,7 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
}
}

group_name = dict_get_string(event_dict, (char_u *)"group", TRUE);
group_name = dict_get_string(event_dict, "group", TRUE);
if (group_name == NULL || *group_name == NUL)
// if the autocmd group name is not specified, then use the current
// autocmd group
Expand Down Expand Up @@ -2865,7 +2869,7 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
{
varnumber_T bnum;

bnum = dict_get_number_def(event_dict, (char_u *)"bufnr", -1);
bnum = dict_get_number_def(event_dict, "bufnr", -1);
if (bnum == -1)
continue;

Expand Down Expand Up @@ -2905,13 +2909,13 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
pat = (char_u *)"";
}

once = dict_get_bool(event_dict, (char_u *)"once", FALSE);
nested = dict_get_bool(event_dict, (char_u *)"nested", FALSE);
once = dict_get_bool(event_dict, "once", FALSE);
nested = dict_get_bool(event_dict, "nested", FALSE);
// if 'replace' is true, then remove all the commands associated with
// this autocmd event/group and add the new command.
replace = dict_get_bool(event_dict, (char_u *)"replace", FALSE);
replace = dict_get_bool(event_dict, "replace", FALSE);

cmd = dict_get_string(event_dict, (char_u *)"cmd", TRUE);
cmd = dict_get_string(event_dict, "cmd", TRUE);
if (cmd == NULL)
{
if (delete)
Expand Down Expand Up @@ -3073,8 +3077,7 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
// return only the autocmds in the specified group
if (dict_has_key(argvars[0].vval.v_dict, "group"))
{
name = dict_get_string(argvars[0].vval.v_dict,
(char_u *)"group", TRUE);
name = dict_get_string(argvars[0].vval.v_dict, "group", TRUE);
if (name == NULL)
return;

Expand All @@ -3098,8 +3101,7 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
{
int i;

name = dict_get_string(argvars[0].vval.v_dict,
(char_u *)"event", TRUE);
name = dict_get_string(argvars[0].vval.v_dict, "event", TRUE);
if (name == NULL)
return;

Expand All @@ -3124,8 +3126,7 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
// return only the autocmds for the specified pattern
if (dict_has_key(argvars[0].vval.v_dict, "pattern"))
{
pat = dict_get_string(argvars[0].vval.v_dict,
(char_u *)"pattern", TRUE);
pat = dict_get_string(argvars[0].vval.v_dict, "pattern", TRUE);
if (pat == NULL)
return;
}
Expand Down
10 changes: 5 additions & 5 deletions src/change.c
Expand Up @@ -172,9 +172,9 @@ check_recorded_changes(
FOR_ALL_LIST_ITEMS(buf->b_recorded_changes, li)
{
prev_lnum = (linenr_T)dict_get_number(
li->li_tv.vval.v_dict, (char_u *)"lnum");
li->li_tv.vval.v_dict, "lnum");
prev_lnume = (linenr_T)dict_get_number(
li->li_tv.vval.v_dict, (char_u *)"end");
li->li_tv.vval.v_dict, "end");
if (prev_lnum >= lnum || prev_lnum > lnume || prev_lnume >= lnum)
{
// the current change is going to make the line number in
Expand Down Expand Up @@ -384,13 +384,13 @@ invoke_listeners(buf_T *buf)
{
varnumber_T lnum;

lnum = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"lnum");
lnum = dict_get_number(li->li_tv.vval.v_dict, "lnum");
if (start > lnum)
start = lnum;
lnum = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"end");
lnum = dict_get_number(li->li_tv.vval.v_dict, "end");
if (end < lnum)
end = lnum;
added += dict_get_number(li->li_tv.vval.v_dict, (char_u *)"added");
added += dict_get_number(li->li_tv.vval.v_dict, "added");
}
argv[1].v_type = VAR_NUMBER;
argv[1].vval.v_number = start;
Expand Down
16 changes: 12 additions & 4 deletions src/configure.ac
Expand Up @@ -4004,7 +4004,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
dnl Check for timer_create. It probably requires the 'rt' library.
dnl Run the program to find out if timer_create(CLOCK_MONOTONIC) actually
dnl works, on Solaris timer_create() exists but fails at runtime.
AC_MSG_CHECKING([for timer_create])
AC_CACHE_CHECK([for timer_create], [vim_cv_timer_create],
save_LIBS="$LIBS"
LIBS="$LIBS -lrt"
AC_RUN_IFELSE([AC_LANG_PROGRAM([
Expand All @@ -4021,7 +4021,7 @@ static void set_flag(union sigval sv) {}
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
exit(1); // cannot create a monotonic timer
])],
AC_MSG_RESULT(yes; with -lrt); AC_DEFINE(HAVE_TIMER_CREATE),
AC_MSG_NOTICE(timer_create with -lrt); vim_cv_timer_create=yes,
LIBS="$save_LIBS"
AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include<signal.h>
Expand All @@ -4037,8 +4037,16 @@ static void set_flag(union sigval sv) {}
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
exit(1); // cannot create a monotonic timer
])],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMER_CREATE),
AC_MSG_RESULT(no)))
vim_cv_timer_create=yes,
vim_cv_timer_create=no),
AC_MSG_ERROR(cross-compiling: please set 'vim_cv_timer_create')
)
)

if test "x$vim_cv_timer_create" = "xyes" ; then
AC_DEFINE(HAVE_TIMER_CREATE)
fi


AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
[
Expand Down
18 changes: 9 additions & 9 deletions src/dict.c
Expand Up @@ -662,11 +662,11 @@ dict_has_key(dict_T *d, char *key)
* Returns FAIL if the entry doesn't exist or out of memory.
*/
int
dict_get_tv(dict_T *d, char_u *key, typval_T *rettv)
dict_get_tv(dict_T *d, char *key, typval_T *rettv)
{
dictitem_T *di;

di = dict_find(d, key, -1);
di = dict_find(d, (char_u *)key, -1);
if (di == NULL)
return FAIL;
copy_tv(&di->di_tv, rettv);
Expand All @@ -680,12 +680,12 @@ dict_get_tv(dict_T *d, char_u *key, typval_T *rettv)
* Returns NULL if the entry doesn't exist or out of memory.
*/
char_u *
dict_get_string(dict_T *d, char_u *key, int save)
dict_get_string(dict_T *d, char *key, int save)
{
dictitem_T *di;
char_u *s;

di = dict_find(d, key, -1);
di = dict_find(d, (char_u *)key, -1);
if (di == NULL)
return NULL;
s = tv_get_string(&di->di_tv);
Expand All @@ -699,7 +699,7 @@ dict_get_string(dict_T *d, char_u *key, int save)
* Returns 0 if the entry doesn't exist.
*/
varnumber_T
dict_get_number(dict_T *d, char_u *key)
dict_get_number(dict_T *d, char *key)
{
return dict_get_number_def(d, key, 0);
}
Expand All @@ -709,11 +709,11 @@ dict_get_number(dict_T *d, char_u *key)
* Returns "def" if the entry doesn't exist.
*/
varnumber_T
dict_get_number_def(dict_T *d, char_u *key, int def)
dict_get_number_def(dict_T *d, char *key, int def)
{
dictitem_T *di;

di = dict_find(d, key, -1);
di = dict_find(d, (char_u *)key, -1);
if (di == NULL)
return def;
return tv_get_number(&di->di_tv);
Expand Down Expand Up @@ -745,11 +745,11 @@ dict_get_number_check(dict_T *d, char_u *key)
* Returns "def" if the entry doesn't exist.
*/
varnumber_T
dict_get_bool(dict_T *d, char_u *key, int def)
dict_get_bool(dict_T *d, char *key, int def)
{
dictitem_T *di;

di = dict_find(d, key, -1);
di = dict_find(d, (char_u *)key, -1);
if (di == NULL)
return def;
return tv_get_bool(&di->di_tv);
Expand Down
6 changes: 6 additions & 0 deletions src/errors.h
Expand Up @@ -3308,4 +3308,10 @@ EXTERN char e_could_not_check_for_pending_sigalrm_str[]
#ifdef FEAT_EVAL
EXTERN char e_substitute_nesting_too_deep[]
INIT(= N_("E1290: substitute nesting too deep"));
EXTERN char e_invalid_argument_nr[]
INIT(= N_("E1291: Invalid argument: %ld"));
#endif
#ifdef FEAT_CMDWIN
EXTERN char e_cmdline_window_already_open[]
INIT(= N_("E1292: Command-line window is already open"));
#endif
6 changes: 3 additions & 3 deletions src/evalbuffer.c
Expand Up @@ -695,9 +695,9 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv)
if (sel_d != NULL)
{
filtered = TRUE;
sel_buflisted = dict_get_bool(sel_d, (char_u *)"buflisted", FALSE);
sel_bufloaded = dict_get_bool(sel_d, (char_u *)"bufloaded", FALSE);
sel_bufmodified = dict_get_bool(sel_d, (char_u *)"bufmodified",
sel_buflisted = dict_get_bool(sel_d, "buflisted", FALSE);
sel_bufloaded = dict_get_bool(sel_d, "bufloaded", FALSE);
sel_bufmodified = dict_get_bool(sel_d, "bufmodified",
FALSE);
}
}
Expand Down
11 changes: 5 additions & 6 deletions src/evalfunc.c
Expand Up @@ -4217,8 +4217,7 @@ f_expandcmd(typval_T *argvars, typval_T *rettv)
return;

if (argvars[1].v_type == VAR_DICT
&& dict_get_bool(argvars[1].vval.v_dict, (char_u *)"errmsg",
VVAL_FALSE))
&& dict_get_bool(argvars[1].vval.v_dict, "errmsg", VVAL_FALSE))
emsgoff = FALSE;

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

if ((d = argvars[0].vval.v_dict) != NULL)
{
csearch = dict_get_string(d, (char_u *)"char", FALSE);
csearch = dict_get_string(d, "char", FALSE);
if (csearch != NULL)
{
if (enc_utf8)
Expand Down Expand Up @@ -9403,7 +9402,7 @@ f_setreg(typval_T *argvars, typval_T *rettv)
if (di != NULL)
regcontents = &di->di_tv;

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

if (regname == '"')
{
stropt = dict_get_string(d, (char_u *)"points_to", FALSE);
stropt = dict_get_string(d, "points_to", FALSE);
if (stropt != NULL)
{
pointreg = *stropt;
regname = pointreg;
}
}
else if (dict_get_bool(d, (char_u *)"isunnamed", -1) > 0)
else if (dict_get_bool(d, "isunnamed", -1) > 0)
pointreg = regname;
}
else
Expand Down

0 comments on commit c0d5f05

Please sign in to comment.