mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
Merge pull request #20088 from zeertzjq/vim-9.0.0386
vim-patch:9.0.0386: some code blocks are nested too deep N/A patches for version.c: vim-patch:9.0.0385: GUI: when CTRL-D is mapped in Insert mode it gets inserted
This commit is contained in:
@@ -79,11 +79,12 @@ void alist_expand(int *fnum_list, int fnum_len)
|
||||
{
|
||||
char *save_p_su = p_su;
|
||||
|
||||
char **old_arg_files = xmalloc(sizeof(*old_arg_files) * GARGCOUNT);
|
||||
|
||||
// Don't use 'suffixes' here. This should work like the shell did the
|
||||
// expansion. Also, the vimrc file isn't read yet, thus the user
|
||||
// can't set the options.
|
||||
p_su = empty_option;
|
||||
char **old_arg_files = xmalloc(sizeof(*old_arg_files) * GARGCOUNT);
|
||||
for (int i = 0; i < GARGCOUNT; i++) {
|
||||
old_arg_files[i] = vim_strsave(GARGLIST[i].ae_fname);
|
||||
}
|
||||
@@ -308,47 +309,16 @@ static void alist_add_list(int count, char **files, int after, bool will_edit)
|
||||
}
|
||||
}
|
||||
|
||||
/// @param str
|
||||
/// @param what
|
||||
/// AL_SET: Redefine the argument list to 'str'.
|
||||
/// AL_ADD: add files in 'str' to the argument list after "after".
|
||||
/// AL_DEL: remove files in 'str' from the argument list.
|
||||
/// @param after
|
||||
/// 0 means before first one
|
||||
/// @param will_edit will edit added argument
|
||||
///
|
||||
/// @return FAIL for failure, OK otherwise.
|
||||
static int do_arglist(char *str, int what, int after, bool will_edit)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
/// Delete the file names in "alist_ga" from the argument list.
|
||||
static void arglist_del_files(garray_T *alist_ga)
|
||||
{
|
||||
garray_T new_ga;
|
||||
int exp_count;
|
||||
char **exp_files;
|
||||
char *p;
|
||||
int match;
|
||||
int arg_escaped = true;
|
||||
|
||||
// Set default argument for ":argadd" command.
|
||||
if (what == AL_ADD && *str == NUL) {
|
||||
if (curbuf->b_ffname == NULL) {
|
||||
return FAIL;
|
||||
}
|
||||
str = curbuf->b_fname;
|
||||
arg_escaped = false;
|
||||
}
|
||||
|
||||
// Collect all file name arguments in "new_ga".
|
||||
get_arglist(&new_ga, str, arg_escaped);
|
||||
|
||||
if (what == AL_DEL) {
|
||||
regmatch_T regmatch;
|
||||
bool didone;
|
||||
|
||||
// Delete the items: use each item as a regexp and find a match in the
|
||||
// argument list.
|
||||
regmatch.rm_ic = p_fic; // ignore case when 'fileignorecase' is set
|
||||
for (int i = 0; i < new_ga.ga_len && !got_int; i++) {
|
||||
p = ((char **)new_ga.ga_data)[i];
|
||||
for (int i = 0; i < alist_ga->ga_len && !got_int; i++) {
|
||||
char *p = ((char **)alist_ga->ga_data)[i];
|
||||
p = file_pat_to_reg_pat(p, NULL, NULL, false);
|
||||
if (p == NULL) {
|
||||
break;
|
||||
@@ -359,8 +329,8 @@ static int do_arglist(char *str, int what, int after, bool will_edit)
|
||||
break;
|
||||
}
|
||||
|
||||
didone = false;
|
||||
for (match = 0; match < ARGCOUNT; match++) {
|
||||
bool didone = false;
|
||||
for (int match = 0; match < ARGCOUNT; match++) {
|
||||
if (vim_regexec(®match, alist_name(&ARGLIST[match]), (colnr_T)0)) {
|
||||
didone = true;
|
||||
xfree(ARGLIST[match].ae_fname);
|
||||
@@ -377,10 +347,44 @@ static int do_arglist(char *str, int what, int after, bool will_edit)
|
||||
vim_regfree(regmatch.regprog);
|
||||
xfree(p);
|
||||
if (!didone) {
|
||||
semsg(_(e_nomatch2), ((char **)new_ga.ga_data)[i]);
|
||||
semsg(_(e_nomatch2), ((char **)alist_ga->ga_data)[i]);
|
||||
}
|
||||
}
|
||||
ga_clear(&new_ga);
|
||||
ga_clear(alist_ga);
|
||||
}
|
||||
|
||||
/// @param str
|
||||
/// @param what
|
||||
/// AL_SET: Redefine the argument list to 'str'.
|
||||
/// AL_ADD: add files in 'str' to the argument list after "after".
|
||||
/// AL_DEL: remove files in 'str' from the argument list.
|
||||
/// @param after
|
||||
/// 0 means before first one
|
||||
/// @param will_edit will edit added argument
|
||||
///
|
||||
/// @return FAIL for failure, OK otherwise.
|
||||
static int do_arglist(char *str, int what, int after, bool will_edit)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
garray_T new_ga;
|
||||
int exp_count;
|
||||
char **exp_files;
|
||||
int arg_escaped = true;
|
||||
|
||||
// Set default argument for ":argadd" command.
|
||||
if (what == AL_ADD && *str == NUL) {
|
||||
if (curbuf->b_ffname == NULL) {
|
||||
return FAIL;
|
||||
}
|
||||
str = curbuf->b_fname;
|
||||
arg_escaped = false;
|
||||
}
|
||||
|
||||
// Collect all file name arguments in "new_ga".
|
||||
get_arglist(&new_ga, str, arg_escaped);
|
||||
|
||||
if (what == AL_DEL) {
|
||||
arglist_del_files(&new_ga);
|
||||
} else {
|
||||
int i = expand_wildcards(new_ga.ga_len, new_ga.ga_data,
|
||||
&exp_count, &exp_files,
|
||||
@@ -471,22 +475,27 @@ void ex_args(exarg_T *eap)
|
||||
ex_next(eap);
|
||||
} else if (eap->cmdidx == CMD_args) {
|
||||
// ":args": list arguments.
|
||||
if (ARGCOUNT > 0) {
|
||||
if (ARGCOUNT <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
char **items = xmalloc(sizeof(char *) * (size_t)ARGCOUNT);
|
||||
|
||||
// Overwrite the command, for a short list there is no scrolling
|
||||
// required and no wait_return().
|
||||
gotocmdline(true);
|
||||
|
||||
for (int i = 0; i < ARGCOUNT; i++) {
|
||||
items[i] = alist_name(&ARGLIST[i]);
|
||||
}
|
||||
list_in_columns(items, ARGCOUNT, curwin->w_arg_idx);
|
||||
xfree(items);
|
||||
}
|
||||
} else if (eap->cmdidx == CMD_arglocal) {
|
||||
garray_T *gap = &curwin->w_alist->al_ga;
|
||||
|
||||
// ":argslocal": make a local copy of the global argument list.
|
||||
ga_grow(gap, GARGCOUNT);
|
||||
|
||||
for (int i = 0; i < GARGCOUNT; i++) {
|
||||
if (GARGLIST[i].ae_fname != NULL) {
|
||||
AARGLIST(curwin->w_alist)[gap->ga_len].ae_fname = xstrdup(GARGLIST[i].ae_fname);
|
||||
@@ -1126,7 +1135,11 @@ void f_argv(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
aentry_T *arglist = NULL;
|
||||
int argcount = -1;
|
||||
|
||||
if (argvars[0].v_type != VAR_UNKNOWN) {
|
||||
if (argvars[0].v_type == VAR_UNKNOWN) {
|
||||
get_arglist_as_rettv(ARGLIST, ARGCOUNT, rettv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (argvars[1].v_type == VAR_UNKNOWN) {
|
||||
arglist = ARGLIST;
|
||||
argcount = ARGCOUNT;
|
||||
@@ -1142,6 +1155,7 @@ void f_argv(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
argcount = WARGCOUNT(wp);
|
||||
}
|
||||
}
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
int idx = (int)tv_get_number_chk(&argvars[0], NULL);
|
||||
@@ -1150,7 +1164,4 @@ void f_argv(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
} else if (idx == -1) {
|
||||
get_arglist_as_rettv(arglist, argcount, rettv);
|
||||
}
|
||||
} else {
|
||||
get_arglist_as_rettv(ARGLIST, ARGCOUNT, rettv);
|
||||
}
|
||||
}
|
||||
|
@@ -5544,9 +5544,9 @@ void ex_cd(exarg_T *eap)
|
||||
// for non-UNIX ":cd" means: print current directory unless 'cdhome' is set
|
||||
if (*new_dir == NUL && !p_cdh) {
|
||||
ex_pwd(NULL);
|
||||
} else
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
CdScope scope = kCdScopeGlobal;
|
||||
switch (eap->cmdidx) {
|
||||
case CMD_tcd:
|
||||
@@ -5567,7 +5567,6 @@ void ex_cd(exarg_T *eap)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// ":pwd".
|
||||
static void ex_pwd(exarg_T *eap)
|
||||
|
@@ -506,17 +506,19 @@ bool striequal(const char *a, const char *b)
|
||||
// Did_outofmem_msg is reset when a character is read.
|
||||
void do_outofmem_msg(size_t size)
|
||||
{
|
||||
if (!did_outofmem_msg) {
|
||||
if (did_outofmem_msg) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't hide this message
|
||||
emsg_silent = 0;
|
||||
|
||||
/* Must come first to avoid coming back here when printing the error
|
||||
* message fails, e.g. when setting v:errmsg. */
|
||||
// Must come first to avoid coming back here when printing the error
|
||||
// message fails, e.g. when setting v:errmsg.
|
||||
did_outofmem_msg = true;
|
||||
|
||||
semsg(_("E342: Out of memory! (allocating %" PRIu64 " bytes)"), (uint64_t)size);
|
||||
}
|
||||
}
|
||||
|
||||
/// Writes time_t to "buf[8]".
|
||||
void time_to_bytes(time_t time_, uint8_t buf[8])
|
||||
|
@@ -1042,14 +1042,14 @@ void pum_show_popupmenu(vimmenu_T *menu)
|
||||
pum_scrollbar = 0;
|
||||
pum_height = pum_size;
|
||||
pum_position_at_mouse(20);
|
||||
|
||||
pum_selected = -1;
|
||||
pum_first = 0;
|
||||
if (!p_mousemev) {
|
||||
// Pretend 'mousemoveevent' is set.
|
||||
ui_call_option_set(STATIC_CSTR_AS_STRING("mousemoveevent"), BOOLEAN_OBJ(true));
|
||||
}
|
||||
|
||||
pum_selected = -1;
|
||||
pum_first = 0;
|
||||
|
||||
for (;;) {
|
||||
pum_is_visible = true;
|
||||
pum_is_drawn = true;
|
||||
|
Reference in New Issue
Block a user