mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
Vendored
+4
@@ -189,6 +189,10 @@ def DetectFromHashBang(firstline: string)
|
||||
elseif name =~ 'gforth\>'
|
||||
set ft=forth
|
||||
|
||||
# Icon
|
||||
elseif name =~ 'icon\>'
|
||||
set ft=icon
|
||||
|
||||
endif
|
||||
enddef
|
||||
|
||||
|
||||
+1
-1
@@ -5338,7 +5338,7 @@ f_ch_info(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
return;
|
||||
|
||||
channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
|
||||
if (channel != NULL && rettv_dict_alloc(rettv) != FAIL)
|
||||
if (channel != NULL && rettv_dict_alloc(rettv) == OK)
|
||||
channel_info(channel, rettv->vval.v_dict);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -3766,7 +3766,7 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
|
||||
else
|
||||
pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
|
||||
|
||||
if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
|
||||
if (rettv_list_alloc(rettv) == OK && pat != NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
+2
-2
@@ -2567,7 +2567,7 @@ ex_loadkeymap(exarg_T *eap)
|
||||
vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s %s",
|
||||
((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from,
|
||||
((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].to);
|
||||
(void)do_map(2, buf, MODE_LANGMAP, FALSE);
|
||||
(void)do_map(MAPTYPE_NOREMAP, buf, MODE_LANGMAP, FALSE);
|
||||
}
|
||||
|
||||
p_cpo = save_cpo;
|
||||
@@ -2598,7 +2598,7 @@ keymap_unload(void)
|
||||
for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
|
||||
{
|
||||
vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from);
|
||||
(void)do_map(1, buf, MODE_LANGMAP, FALSE);
|
||||
(void)do_map(MAPTYPE_UNMAP, buf, MODE_LANGMAP, FALSE);
|
||||
}
|
||||
keymap_clear(&curbuf->b_kmap_ga);
|
||||
|
||||
|
||||
+1
-1
@@ -680,7 +680,7 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv)
|
||||
int sel_bufloaded = FALSE;
|
||||
int sel_bufmodified = FALSE;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script()
|
||||
|
||||
+19
-15
@@ -3732,7 +3732,7 @@ f_environ(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
extern char **environ;
|
||||
# endif
|
||||
|
||||
if (rettv_dict_alloc(rettv) != OK)
|
||||
if (rettv_dict_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
# ifdef MSWIN
|
||||
@@ -4159,7 +4159,7 @@ f_expand(typval_T *argvars, typval_T *rettv)
|
||||
emsg(errormsg);
|
||||
if (rettv->v_type == VAR_LIST)
|
||||
{
|
||||
if (rettv_list_alloc(rettv) != FAIL && result != NULL)
|
||||
if (rettv_list_alloc(rettv) == OK && result != NULL)
|
||||
list_append_string(rettv->vval.v_list, result, -1);
|
||||
vim_free(result);
|
||||
}
|
||||
@@ -4182,7 +4182,7 @@ f_expand(typval_T *argvars, typval_T *rettv)
|
||||
if (rettv->v_type == VAR_STRING)
|
||||
rettv->vval.v_string = ExpandOne(&xpc, s, NULL,
|
||||
options, WILD_ALL);
|
||||
else if (rettv_list_alloc(rettv) != FAIL)
|
||||
else if (rettv_list_alloc(rettv) == OK)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -4784,7 +4784,7 @@ f_getchangelist(typval_T *argvars, typval_T *rettv)
|
||||
dict_T *d;
|
||||
int changelistindex;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL)
|
||||
@@ -4929,7 +4929,7 @@ f_getcharpos(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
static void
|
||||
f_getcharsearch(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
{
|
||||
if (rettv_dict_alloc(rettv) != FAIL)
|
||||
if (rettv_dict_alloc(rettv) == OK)
|
||||
{
|
||||
dict_T *dict = rettv->vval.v_dict;
|
||||
|
||||
@@ -5016,7 +5016,7 @@ f_getjumplist(typval_T *argvars, typval_T *rettv)
|
||||
list_T *l;
|
||||
dict_T *d;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script()
|
||||
@@ -5221,7 +5221,7 @@ f_gettagstack(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
win_T *wp = curwin; // default is current window
|
||||
|
||||
if (rettv_dict_alloc(rettv) != OK)
|
||||
if (rettv_dict_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
|
||||
@@ -7879,7 +7879,7 @@ f_printf(typval_T *argvars, typval_T *rettv)
|
||||
static void
|
||||
f_pum_getpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||
{
|
||||
if (rettv_dict_alloc(rettv) != OK)
|
||||
if (rettv_dict_alloc(rettv) == FAIL)
|
||||
return;
|
||||
pum_set_event_info(rettv->vval.v_dict);
|
||||
}
|
||||
@@ -8168,7 +8168,7 @@ f_range(typval_T *argvars, typval_T *rettv)
|
||||
varnumber_T stride = 1;
|
||||
int error = FALSE;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script()
|
||||
@@ -9010,6 +9010,10 @@ do_searchpair(
|
||||
if (skip != NULL)
|
||||
use_skip = eval_expr_valid_arg(skip);
|
||||
|
||||
#ifdef FEAT_RELTIME
|
||||
if (time_limit > 0)
|
||||
init_regexp_timeout(time_limit);
|
||||
#endif
|
||||
save_cursor = curwin->w_cursor;
|
||||
pos = curwin->w_cursor;
|
||||
CLEAR_POS(&firstpos);
|
||||
@@ -9021,9 +9025,6 @@ do_searchpair(
|
||||
|
||||
CLEAR_FIELD(sia);
|
||||
sia.sa_stop_lnum = lnum_stop;
|
||||
#ifdef FEAT_RELTIME
|
||||
sia.sa_tm = time_limit;
|
||||
#endif
|
||||
n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
|
||||
options, RE_SEARCH, &sia);
|
||||
if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos)))
|
||||
@@ -9109,6 +9110,9 @@ do_searchpair(
|
||||
curwin->w_cursor = save_cursor;
|
||||
|
||||
theend:
|
||||
#ifdef FEAT_RELTIME
|
||||
disable_regexp_timeout();
|
||||
#endif
|
||||
vim_free(pat2);
|
||||
vim_free(pat3);
|
||||
if (p_cpo == empty_option)
|
||||
@@ -10232,7 +10236,7 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
|
||||
CLEAR_FIELD(str);
|
||||
|
||||
if (rettv_list_alloc(rettv) != FAIL)
|
||||
if (rettv_list_alloc(rettv) == OK)
|
||||
{
|
||||
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
|
||||
&& col >= 0 && col <= (long)STRLEN(ml_get(lnum))
|
||||
@@ -10293,7 +10297,7 @@ f_synstack(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
|
||||
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
|
||||
&& col >= 0 && col <= (long)STRLEN(ml_get(lnum))
|
||||
&& rettv_list_alloc(rettv) != FAIL)
|
||||
&& rettv_list_alloc(rettv) == OK)
|
||||
{
|
||||
(void)syn_get_id(curwin, lnum, col, FALSE, NULL, TRUE);
|
||||
for (i = 0; ; ++i)
|
||||
@@ -10328,7 +10332,7 @@ f_tabpagebuflist(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||
if (tp != NULL)
|
||||
wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
|
||||
}
|
||||
if (wp != NULL && rettv_list_alloc(rettv) != FAIL)
|
||||
if (wp != NULL && rettv_list_alloc(rettv) == OK)
|
||||
{
|
||||
for (; wp != NULL; wp = wp->w_next)
|
||||
if (list_append_number(rettv->vval.v_list,
|
||||
|
||||
+5
-5
@@ -471,7 +471,7 @@ f_gettabinfo(typval_T *argvars, typval_T *rettv)
|
||||
dict_T *d;
|
||||
int tpnr = 0;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
|
||||
@@ -510,7 +510,7 @@ f_getwininfo(typval_T *argvars, typval_T *rettv)
|
||||
dict_T *d;
|
||||
short tabnr = 0, winnr;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
|
||||
@@ -779,7 +779,7 @@ f_win_findbuf(typval_T *argvars, typval_T *rettv)
|
||||
if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
|
||||
return;
|
||||
|
||||
if (rettv_list_alloc(rettv) != FAIL)
|
||||
if (rettv_list_alloc(rettv) == OK)
|
||||
win_findbuf(argvars, rettv->vval.v_list);
|
||||
}
|
||||
|
||||
@@ -847,7 +847,7 @@ f_win_id2tabwin(typval_T *argvars, typval_T *rettv)
|
||||
if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
|
||||
return;
|
||||
|
||||
if (rettv_list_alloc(rettv) != FAIL)
|
||||
if (rettv_list_alloc(rettv) == OK)
|
||||
win_id2tabwin(argvars, rettv->vval.v_list);
|
||||
}
|
||||
|
||||
@@ -1143,7 +1143,7 @@ f_winlayout(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
tabpage_T *tp;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
|
||||
|
||||
+2
-2
@@ -4475,8 +4475,8 @@ open_cmdwin(void)
|
||||
{
|
||||
if (p_wc == TAB)
|
||||
{
|
||||
add_map((char_u *)"<buffer> <Tab> <C-X><C-V>", MODE_INSERT);
|
||||
add_map((char_u *)"<buffer> <Tab> a<C-X><C-V>", MODE_NORMAL);
|
||||
add_map((char_u *)"<buffer> <Tab> <C-X><C-V>", MODE_INSERT, TRUE);
|
||||
add_map((char_u *)"<buffer> <Tab> a<C-X><C-V>", MODE_NORMAL, TRUE);
|
||||
}
|
||||
set_option_value_give_err((char_u *)"ft",
|
||||
0L, (char_u *)"vim", OPT_LOCAL);
|
||||
|
||||
@@ -226,6 +226,11 @@ gui_do_fork(void)
|
||||
int exit_status;
|
||||
pid_t pid = -1;
|
||||
|
||||
#if defined(FEAT_RELTIME) && defined(HAVE_TIMER_CREATE)
|
||||
// a timer is not carried forward
|
||||
delete_timer();
|
||||
#endif
|
||||
|
||||
// Setup a pipe between the child and the parent, so that the parent
|
||||
// knows when the child has done the setsid() call and is allowed to
|
||||
// exit.
|
||||
|
||||
+16
-8
@@ -1612,6 +1612,20 @@ copy_indent(int size, char_u *src)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Give a "resulting text too long" error and maybe set got_int.
|
||||
*/
|
||||
static void
|
||||
emsg_text_too_long(void)
|
||||
{
|
||||
emsg(_(e_resulting_text_too_long));
|
||||
#ifdef FEAT_EVAL
|
||||
// when not inside a try/catch set got_int to break out of any loop
|
||||
if (trylevel == 0)
|
||||
#endif
|
||||
got_int = TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* ":retab".
|
||||
*/
|
||||
@@ -1749,7 +1763,7 @@ ex_retab(exarg_T *eap)
|
||||
new_len = old_len - col + start_col + len + 1;
|
||||
if (new_len <= 0 || new_len >= MAXCOL)
|
||||
{
|
||||
emsg(_(e_resulting_text_too_long));
|
||||
emsg_text_too_long();
|
||||
break;
|
||||
}
|
||||
new_line = alloc(new_len);
|
||||
@@ -1780,13 +1794,7 @@ ex_retab(exarg_T *eap)
|
||||
vcol += chartabsize(ptr + col, (colnr_T)vcol);
|
||||
if (vcol >= MAXCOL)
|
||||
{
|
||||
emsg(_(e_resulting_text_too_long));
|
||||
// when not inside a try/catch set got_int to break out of any
|
||||
// loop
|
||||
#ifdef FEAT_EVAL
|
||||
if (trylevel == 0)
|
||||
#endif
|
||||
got_int = TRUE;
|
||||
emsg_text_too_long();
|
||||
break;
|
||||
}
|
||||
if (has_mbyte)
|
||||
|
||||
+1
-1
@@ -3093,7 +3093,7 @@ f_complete_info(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
list_T *what_list = NULL;
|
||||
|
||||
if (rettv_dict_alloc(rettv) != OK)
|
||||
if (rettv_dict_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_opt_list_arg(argvars, 0) == FAIL)
|
||||
|
||||
@@ -1905,7 +1905,7 @@ f_job_info(typval_T *argvars, typval_T *rettv)
|
||||
job_T *job;
|
||||
|
||||
job = get_job_arg(&argvars[0]);
|
||||
if (job != NULL && rettv_dict_alloc(rettv) != FAIL)
|
||||
if (job != NULL && rettv_dict_alloc(rettv) == OK)
|
||||
job_info(job, rettv->vval.v_dict);
|
||||
}
|
||||
else if (rettv_list_alloc(rettv) == OK)
|
||||
|
||||
+1
-1
@@ -1762,7 +1762,7 @@ list_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg)
|
||||
}
|
||||
|
||||
vimlist_remove(l, item, item2);
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
rl = rettv->vval.v_list;
|
||||
|
||||
+1
-1
@@ -1489,7 +1489,7 @@ main_loop(
|
||||
update_screen(0);
|
||||
mch_enable_flush();
|
||||
}
|
||||
else if (redraw_cmdline || clear_cmdline)
|
||||
else if (redraw_cmdline || clear_cmdline || redraw_mode)
|
||||
showmode();
|
||||
redraw_statuslines();
|
||||
if (need_maketitle)
|
||||
|
||||
@@ -293,7 +293,9 @@ map_add(
|
||||
* noreabbr {lhs} {rhs} : same, but no remapping for {rhs}
|
||||
* unabbr {lhs} : remove abbreviation for {lhs}
|
||||
*
|
||||
* maptype: 0 for :map, 1 for :unmap, 2 for noremap.
|
||||
* maptype: MAPTYPE_MAP for :map
|
||||
* MAPTYPE_UNMAP for :unmap
|
||||
* MAPTYPE_NOREMAP for noremap
|
||||
*
|
||||
* arg is pointer to any arguments. Note: arg cannot be a read-only string,
|
||||
* it will be modified.
|
||||
@@ -360,7 +362,7 @@ do_map(
|
||||
abbr_table = &first_abbr;
|
||||
|
||||
// For ":noremap" don't remap, otherwise do remap.
|
||||
if (maptype == 2)
|
||||
if (maptype == MAPTYPE_NOREMAP)
|
||||
noremap = REMAP_NONE;
|
||||
else
|
||||
noremap = REMAP_YES;
|
||||
@@ -436,7 +438,7 @@ do_map(
|
||||
// with :unmap white space is included in the keys, no argument possible.
|
||||
p = keys;
|
||||
do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL);
|
||||
while (*p && (maptype == 1 || !VIM_ISWHITE(*p)))
|
||||
while (*p && (maptype == MAPTYPE_UNMAP || !VIM_ISWHITE(*p)))
|
||||
{
|
||||
if ((p[0] == Ctrl_V || (do_backslash && p[0] == '\\')) &&
|
||||
p[1] != NUL)
|
||||
@@ -450,10 +452,10 @@ do_map(
|
||||
rhs = p;
|
||||
hasarg = (*rhs != NUL);
|
||||
haskey = (*keys != NUL);
|
||||
do_print = !haskey || (maptype != 1 && !hasarg);
|
||||
do_print = !haskey || (maptype != MAPTYPE_UNMAP && !hasarg);
|
||||
|
||||
// check for :unmap without argument
|
||||
if (maptype == 1 && !haskey)
|
||||
if (maptype == MAPTYPE_UNMAP && !haskey)
|
||||
{
|
||||
retval = 1;
|
||||
goto theend;
|
||||
@@ -524,7 +526,7 @@ do_map(
|
||||
goto theend;
|
||||
}
|
||||
|
||||
if (abbrev && maptype != 1)
|
||||
if (abbrev && maptype != MAPTYPE_UNMAP)
|
||||
{
|
||||
// If an abbreviation ends in a keyword character, the
|
||||
// rest must be all keyword-char or all non-keyword-char.
|
||||
@@ -580,7 +582,7 @@ do_map(
|
||||
|
||||
// Check if a new local mapping wasn't already defined globally.
|
||||
if (unique && map_table == curbuf->b_maphash
|
||||
&& haskey && hasarg && maptype != 1)
|
||||
&& haskey && hasarg && maptype != MAPTYPE_UNMAP)
|
||||
{
|
||||
// need to loop over all global hash lists
|
||||
for (hash = 0; hash < 256 && !got_int; ++hash)
|
||||
@@ -615,7 +617,8 @@ do_map(
|
||||
}
|
||||
|
||||
// When listing global mappings, also list buffer-local ones here.
|
||||
if (map_table != curbuf->b_maphash && !hasarg && maptype != 1)
|
||||
if (map_table != curbuf->b_maphash && !hasarg
|
||||
&& maptype != MAPTYPE_UNMAP)
|
||||
{
|
||||
// need to loop over all global hash lists
|
||||
for (hash = 0; hash < 256 && !got_int; ++hash)
|
||||
@@ -659,7 +662,7 @@ do_map(
|
||||
// an entry with a matching 'to' part. This was done to allow
|
||||
// ":ab foo bar" to be unmapped by typing ":unab foo", where "foo" will
|
||||
// be replaced by "bar" because of the abbreviation.
|
||||
for (round = 0; (round == 0 || maptype == 1) && round <= 1
|
||||
for (round = 0; (round == 0 || maptype == MAPTYPE_UNMAP) && round <= 1
|
||||
&& !did_it && !got_int; ++round)
|
||||
{
|
||||
// need to loop over all hash lists
|
||||
@@ -704,7 +707,7 @@ do_map(
|
||||
}
|
||||
if (STRNCMP(p, keys, (size_t)(n < len ? n : len)) == 0)
|
||||
{
|
||||
if (maptype == 1)
|
||||
if (maptype == MAPTYPE_UNMAP)
|
||||
{
|
||||
// Delete entry.
|
||||
// Only accept a full match. For abbreviations
|
||||
@@ -805,7 +808,7 @@ do_map(
|
||||
}
|
||||
}
|
||||
|
||||
if (maptype == 1)
|
||||
if (maptype == MAPTYPE_UNMAP)
|
||||
{
|
||||
// delete entry
|
||||
if (!did_it)
|
||||
@@ -2376,7 +2379,7 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact)
|
||||
}
|
||||
|
||||
}
|
||||
else if (rettv_dict_alloc(rettv) != FAIL && rhs != NULL)
|
||||
else if (rettv_dict_alloc(rettv) == OK && rhs != NULL)
|
||||
mapblock2dict(mp, rettv->vval.v_dict,
|
||||
did_simplify ? keys_simplified : NULL,
|
||||
buffer_local, abbr);
|
||||
@@ -2406,7 +2409,7 @@ f_maplist(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
if (argvars[0].v_type != VAR_UNKNOWN)
|
||||
abbr = tv_get_bool(&argvars[0]);
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
validate_maphash();
|
||||
@@ -2661,7 +2664,7 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
if (arg == NULL)
|
||||
return;
|
||||
}
|
||||
do_map(1, arg, mode, is_abbr);
|
||||
do_map(MAPTYPE_UNMAP, arg, mode, is_abbr);
|
||||
vim_free(arg);
|
||||
|
||||
(void)map_add(map_table, abbr_table, lhsraw, rhs, orig_rhs, noremap,
|
||||
@@ -2769,12 +2772,12 @@ init_mappings(void)
|
||||
# endif
|
||||
{
|
||||
for (i = 0; i < (int)ARRAY_LENGTH(cinitmappings); ++i)
|
||||
add_map(cinitmappings[i].arg, cinitmappings[i].mode);
|
||||
add_map(cinitmappings[i].arg, cinitmappings[i].mode, FALSE);
|
||||
}
|
||||
# endif
|
||||
# if defined(FEAT_GUI_MSWIN) || defined(MACOS_X)
|
||||
for (i = 0; i < (int)ARRAY_LENGTH(initmappings); ++i)
|
||||
add_map(initmappings[i].arg, initmappings[i].mode);
|
||||
add_map(initmappings[i].arg, initmappings[i].mode, FALSE);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
@@ -2783,10 +2786,11 @@ init_mappings(void)
|
||||
|| defined(PROTO)
|
||||
/*
|
||||
* Add a mapping "map" for mode "mode".
|
||||
* When "nore" is TRUE use MAPTYPE_NOREMAP.
|
||||
* Need to put string in allocated memory, because do_map() will modify it.
|
||||
*/
|
||||
void
|
||||
add_map(char_u *map, int mode)
|
||||
add_map(char_u *map, int mode, int nore)
|
||||
{
|
||||
char_u *s;
|
||||
char_u *cpo_save = p_cpo;
|
||||
@@ -2795,7 +2799,7 @@ add_map(char_u *map, int mode)
|
||||
s = vim_strsave(map);
|
||||
if (s != NULL)
|
||||
{
|
||||
(void)do_map(0, s, mode, FALSE);
|
||||
(void)do_map(nore ? MAPTYPE_NOREMAP : MAPTYPE_MAP, s, mode, FALSE);
|
||||
vim_free(s);
|
||||
}
|
||||
p_cpo = cpo_save;
|
||||
@@ -3002,7 +3006,8 @@ do_exmap(exarg_T *eap, int isabbrev)
|
||||
cmdp = eap->cmd;
|
||||
mode = get_map_mode(&cmdp, eap->forceit || isabbrev);
|
||||
|
||||
switch (do_map((*cmdp == 'n') ? 2 : (*cmdp == 'u'),
|
||||
switch (do_map(*cmdp == 'n' ? MAPTYPE_NOREMAP
|
||||
: *cmdp == 'u' ? MAPTYPE_UNMAP : MAPTYPE_MAP,
|
||||
eap->arg, mode, isabbrev))
|
||||
{
|
||||
case 1: emsg(_(e_invalid_argument));
|
||||
|
||||
+1
-1
@@ -3327,7 +3327,7 @@ f_menu_info(typval_T *argvars, typval_T *rettv)
|
||||
vimmenu_T *menu;
|
||||
dict_T *retdict;
|
||||
|
||||
if (rettv_dict_alloc(rettv) != OK)
|
||||
if (rettv_dict_alloc(rettv) == FAIL)
|
||||
return;
|
||||
retdict = rettv->vval.v_dict;
|
||||
|
||||
|
||||
+1
-1
@@ -3136,7 +3136,7 @@ f_getmousepos(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
linenr_T lnum = 0;
|
||||
varnumber_T column = 0;
|
||||
|
||||
if (rettv_dict_alloc(rettv) != OK)
|
||||
if (rettv_dict_alloc(rettv) == FAIL)
|
||||
return;
|
||||
d = rettv->vval.v_dict;
|
||||
|
||||
|
||||
+1
-1
@@ -1298,7 +1298,7 @@ f_screenpos(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
int row = 0;
|
||||
int scol = 0, ccol = 0, ecol = 0;
|
||||
|
||||
if (rettv_dict_alloc(rettv) != OK)
|
||||
if (rettv_dict_alloc(rettv) == FAIL)
|
||||
return;
|
||||
dict = rettv->vval.v_dict;
|
||||
|
||||
|
||||
+1
-1
@@ -2323,7 +2323,7 @@ special_keys(char_u *args)
|
||||
strcpy(&keybuf[i], tok);
|
||||
vim_snprintf(cmdbuf, sizeof(cmdbuf),
|
||||
"<silent><%s> :nbkey %s<CR>", keybuf, keybuf);
|
||||
do_map(0, (char_u *)cmdbuf, MODE_NORMAL, FALSE);
|
||||
do_map(MAPTYPE_MAP, (char_u *)cmdbuf, MODE_NORMAL, FALSE);
|
||||
}
|
||||
tok = strtok(NULL, " ");
|
||||
}
|
||||
|
||||
@@ -6800,6 +6800,9 @@ nv_esc(cmdarg_T *cap)
|
||||
msg(_("Type :qa and press <Enter> to exit Vim"));
|
||||
}
|
||||
|
||||
if (restart_edit != 0)
|
||||
redraw_mode = TRUE; // remove "-- (insert) --"
|
||||
|
||||
// Don't reset "restart_edit" when 'insertmode' is set, it won't be
|
||||
// set again below when halfway a mapping.
|
||||
if (!p_im)
|
||||
|
||||
+14
-1
@@ -8269,7 +8269,7 @@ xsmp_close(void)
|
||||
#endif // USE_XSMP
|
||||
|
||||
#if defined(FEAT_RELTIME) || defined(PROTO)
|
||||
# if defined(HAVE_TIMER_CREATE)
|
||||
# if defined(HAVE_TIMER_CREATE) || defined(PROTO)
|
||||
/*
|
||||
* Implement timeout with timer_create() and timer_settime().
|
||||
*/
|
||||
@@ -8353,6 +8353,19 @@ start_timeout(long msec)
|
||||
return &timeout_flag;
|
||||
}
|
||||
|
||||
/*
|
||||
* To be used before fork/exec: delete any created timer.
|
||||
*/
|
||||
void
|
||||
delete_timer(void)
|
||||
{
|
||||
if (timer_created)
|
||||
{
|
||||
timer_delete(timer_id);
|
||||
timer_created = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ void f_maparg(typval_T *argvars, typval_T *rettv);
|
||||
void f_mapcheck(typval_T *argvars, typval_T *rettv);
|
||||
void f_mapset(typval_T *argvars, typval_T *rettv);
|
||||
void init_mappings(void);
|
||||
void add_map(char_u *map, int mode);
|
||||
void add_map(char_u *map, int mode, int nore);
|
||||
int langmap_adjust_mb(int c);
|
||||
void langmap_init(void);
|
||||
void langmap_set(void);
|
||||
|
||||
@@ -88,4 +88,5 @@ void xsmp_init(void);
|
||||
void xsmp_close(void);
|
||||
void stop_timeout(void);
|
||||
const int *start_timeout(long msec);
|
||||
void delete_timer(void);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
+8
-7
@@ -683,10 +683,10 @@ searchit(
|
||||
stop_lnum = extra_arg->sa_stop_lnum;
|
||||
#ifdef FEAT_RELTIME
|
||||
if (extra_arg->sa_tm > 0)
|
||||
{
|
||||
init_regexp_timeout(extra_arg->sa_tm);
|
||||
timed_out = &extra_arg->sa_timed_out;
|
||||
}
|
||||
// Also set the pointer when sa_tm is zero, the caller may have set the
|
||||
// timeout.
|
||||
timed_out = &extra_arg->sa_timed_out;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1114,9 +1114,10 @@ searchit(
|
||||
}
|
||||
while (--count > 0 && found); // stop after count matches or no match
|
||||
|
||||
# ifdef FEAT_RELTIME
|
||||
disable_regexp_timeout();
|
||||
# endif
|
||||
#ifdef FEAT_RELTIME
|
||||
if (extra_arg != NULL && extra_arg->sa_tm > 0)
|
||||
disable_regexp_timeout();
|
||||
#endif
|
||||
vim_regfree(regmatch.regprog);
|
||||
|
||||
if (!found) // did not find it
|
||||
@@ -4874,7 +4875,7 @@ do_fuzzymatch(typval_T *argvars, typval_T *rettv, int retmatchpos)
|
||||
|
||||
// get the fuzzy matches
|
||||
ret = rettv_list_alloc(rettv);
|
||||
if (ret != OK)
|
||||
if (ret == FAIL)
|
||||
goto done;
|
||||
if (retmatchpos)
|
||||
{
|
||||
|
||||
+6
-6
@@ -2335,7 +2335,7 @@ f_sign_define(typval_T *argvars, typval_T *rettv)
|
||||
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
|
||||
{
|
||||
// Define multiple signs
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
sign_define_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
|
||||
@@ -2367,7 +2367,7 @@ f_sign_getdefined(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
char_u *name = NULL;
|
||||
|
||||
if (rettv_list_alloc_id(rettv, aid_sign_getdefined) != OK)
|
||||
if (rettv_list_alloc_id(rettv, aid_sign_getdefined) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
|
||||
@@ -2393,7 +2393,7 @@ f_sign_getplaced(typval_T *argvars, typval_T *rettv)
|
||||
char_u *group = NULL;
|
||||
int notanum = FALSE;
|
||||
|
||||
if (rettv_list_alloc_id(rettv, aid_sign_getplaced) != OK)
|
||||
if (rettv_list_alloc_id(rettv, aid_sign_getplaced) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script()
|
||||
@@ -2661,7 +2661,7 @@ f_sign_placelist(typval_T *argvars, typval_T *rettv)
|
||||
listitem_T *li;
|
||||
int sign_id;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
|
||||
@@ -2721,7 +2721,7 @@ f_sign_undefine(typval_T *argvars, typval_T *rettv)
|
||||
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
|
||||
{
|
||||
// Undefine multiple signs
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
sign_undefine_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
|
||||
@@ -2892,7 +2892,7 @@ f_sign_unplacelist(typval_T *argvars, typval_T *rettv)
|
||||
listitem_T *li;
|
||||
int retval;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
|
||||
|
||||
+1
-1
@@ -1476,7 +1476,7 @@ f_terminalprops(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
int i;
|
||||
# endif
|
||||
|
||||
if (rettv_dict_alloc(rettv) != OK)
|
||||
if (rettv_dict_alloc(rettv) == FAIL)
|
||||
return;
|
||||
# ifdef FEAT_TERMRESPONSE
|
||||
for (i = 0; i < TPR_COUNT; ++i)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
> +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|0|,|0|-|1| @8|A|l@1|
|
||||
@@ -718,6 +718,7 @@ let s:script_checks = {
|
||||
\ 'routeros': [['#!/path/rsc']],
|
||||
\ 'fish': [['#!/path/fish']],
|
||||
\ 'forth': [['#!/path/gforth']],
|
||||
\ 'icon': [['#!/path/icon']],
|
||||
\ }
|
||||
|
||||
" Various forms of "env" optional arguments.
|
||||
|
||||
@@ -118,9 +118,8 @@ func Test_quoteplus()
|
||||
|
||||
let test_call = 'Can you hear me?'
|
||||
let test_response = 'Yes, I can.'
|
||||
let vim_exe = GetVimCommand()
|
||||
let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
|
||||
\ . vim_exe . ' --noplugin --not-a-term -c ''%s'''
|
||||
let testee = 'VIMRUNTIME=' .. $VIMRUNTIME .. '; export VIMRUNTIME;'
|
||||
\ .. GetVimCommand() .. ' --noplugin --not-a-term -c ''%s'''
|
||||
" Ignore the "failed to create input context" error.
|
||||
let cmd = 'call test_ignore_error("E285") | '
|
||||
\ . 'gui -f | '
|
||||
@@ -1595,4 +1594,25 @@ func Test_gui_CTRL_SHIFT_V()
|
||||
unlet g:str
|
||||
endfunc
|
||||
|
||||
func Test_gui_dialog_file()
|
||||
let lines =<< trim END
|
||||
file Xfile
|
||||
normal axxx
|
||||
confirm qa
|
||||
END
|
||||
call writefile(lines, 'Xlines')
|
||||
let prefix = '!'
|
||||
if has('win32')
|
||||
let prefix = '!start '
|
||||
endif
|
||||
execute prefix .. GetVimCommand() .. ' -g -f --clean --gui-dialog-file Xdialog -S Xlines'
|
||||
|
||||
call WaitForAssert({-> assert_true(filereadable('Xdialog'))})
|
||||
call assert_match('Question: Save changes to "Xfile"?', readfile('Xdialog')->join('<NL>'))
|
||||
|
||||
call delete('Xdialog')
|
||||
call delete('Xfile')
|
||||
call delete('Xlines')
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -4,6 +4,7 @@ source shared.vim
|
||||
source check.vim
|
||||
source view_util.vim
|
||||
import './vim9.vim' as v9
|
||||
source screendump.vim
|
||||
|
||||
func Setup_NewWindow()
|
||||
10new
|
||||
@@ -2458,9 +2459,9 @@ func Test_normal33_g_cmd2()
|
||||
call assert_equal(2, line('.'))
|
||||
call assert_fails(':norm! g;', 'E662:')
|
||||
call assert_fails(':norm! g,', 'E663:')
|
||||
let &ul=&ul
|
||||
let &ul = &ul
|
||||
call append('$', ['a', 'b', 'c', 'd'])
|
||||
let &ul=&ul
|
||||
let &ul = &ul
|
||||
call append('$', ['Z', 'Y', 'X', 'W'])
|
||||
let a = execute(':changes')
|
||||
call assert_match('2\s\+0\s\+2', a)
|
||||
@@ -3266,6 +3267,20 @@ func Test_message_when_using_ctrl_c()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_mode_updated_after_ctrl_c()
|
||||
CheckScreendump
|
||||
|
||||
let buf = RunVimInTerminal('', {'rows': 5})
|
||||
call term_sendkeys(buf, "i")
|
||||
call term_sendkeys(buf, "\<C-O>")
|
||||
" wait a moment so that the "-- (insert) --" message is displayed
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, "\<C-C>")
|
||||
call VerifyScreenDump(buf, 'Test_mode_updated_1', {})
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
" Test for '[m', ']m', '[M' and ']M'
|
||||
" Jumping to beginning and end of methods in Java-like languages
|
||||
func Test_java_motion()
|
||||
|
||||
@@ -92,7 +92,7 @@ func RetabLoop()
|
||||
endfunc
|
||||
|
||||
func Test_retab_endless()
|
||||
" inside try/catch we catch the error message
|
||||
" inside try/catch we can catch the error message
|
||||
call setline(1, "\t0\t")
|
||||
let caught = 'no'
|
||||
try
|
||||
@@ -106,13 +106,7 @@ func Test_retab_endless()
|
||||
endfunc
|
||||
|
||||
func Test_nocatch_retab_endless()
|
||||
" FIXME: why does this hang on MS-Windows? Is got_int reset somewhere?
|
||||
if has('win32')
|
||||
let g:skipped_reason = "does not work on MS-Windows"
|
||||
return
|
||||
endif
|
||||
|
||||
" not inside try/catch an interrupt is generated to get out of loops
|
||||
" when not inside try/catch an interrupt is generated to get out of loops
|
||||
call setline(1, "\t0\t")
|
||||
call assert_fails('call RetabLoop()', ['E1240:', 'Interrupted'])
|
||||
|
||||
|
||||
@@ -328,7 +328,31 @@ func Test_searchpair()
|
||||
call assert_equal(3, searchpair('\<if\>', '\<else\>', '\<endif\>', 'W'))
|
||||
call assert_equal([0, 3, 3, 0], getpos('.'))
|
||||
|
||||
q!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_searchpair_timeout()
|
||||
CheckFeature reltime
|
||||
|
||||
func Waitabit()
|
||||
sleep 20m
|
||||
return 1 " skip match
|
||||
endfunc
|
||||
|
||||
new
|
||||
call setline(1, range(100))
|
||||
call setline(1, "(start here")
|
||||
call setline(100, "end here)")
|
||||
let starttime = reltime()
|
||||
|
||||
" A timeout of 100 msec should happen after about five times of 20 msec wait
|
||||
" in Waitabit(). When the timeout applies to each search the elapsed time
|
||||
" will be much longer.
|
||||
call assert_equal(0, searchpair('(', '\d', ')', '', "Waitabit()", 0, 100))
|
||||
let elapsed = reltime(starttime)->reltimefloat()
|
||||
call assert_inrange(0.09, 0.300, elapsed)
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_searchpairpos()
|
||||
|
||||
+1
-1
@@ -1076,7 +1076,7 @@ f_prop_list(typval_T *argvars, typval_T *rettv)
|
||||
|| check_for_opt_dict_arg(argvars, 1) == FAIL))
|
||||
return;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
// default: get text properties on current line
|
||||
|
||||
+2
-2
@@ -172,7 +172,7 @@ f_reltime(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||
proftime_T start;
|
||||
long n1, n2;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script()
|
||||
@@ -787,7 +787,7 @@ f_timer_info(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
timer_T *timer = NULL;
|
||||
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
|
||||
|
||||
@@ -749,6 +749,24 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
5114,
|
||||
/**/
|
||||
5113,
|
||||
/**/
|
||||
5112,
|
||||
/**/
|
||||
5111,
|
||||
/**/
|
||||
5110,
|
||||
/**/
|
||||
5109,
|
||||
/**/
|
||||
5108,
|
||||
/**/
|
||||
5107,
|
||||
/**/
|
||||
5106,
|
||||
/**/
|
||||
5105,
|
||||
/**/
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# define MSWIN
|
||||
#endif
|
||||
|
||||
#ifdef MSWIN
|
||||
#if defined(MSWIN) && !defined(PROTO)
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
@@ -379,7 +379,7 @@ typedef long long_i;
|
||||
* We assume that when fseeko() is available then ftello() is too.
|
||||
* Note that Windows has different function names.
|
||||
*/
|
||||
#ifdef MSWIN
|
||||
#if defined(MSWIN) && !defined(PROTO)
|
||||
typedef __int64 off_T;
|
||||
# ifdef __MINGW32__
|
||||
# define vim_lseek lseek64
|
||||
@@ -975,6 +975,11 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring);
|
||||
#define KEY_OPEN_BACK 0x102
|
||||
#define KEY_COMPLETE 0x103 // end of completion
|
||||
|
||||
// Used for the first argument of do_map()
|
||||
#define MAPTYPE_MAP 0
|
||||
#define MAPTYPE_UNMAP 1
|
||||
#define MAPTYPE_NOREMAP 2
|
||||
|
||||
// Values for "noremap" argument of ins_typebuf(). Also used for
|
||||
// map->m_noremap and menu->noremap[].
|
||||
#define REMAP_YES 0 // allow remapping
|
||||
|
||||
Reference in New Issue
Block a user