Merge #9067 from janlazo/vim-8.0.1485

This commit is contained in:
Justin M. Keyes 2018-09-30 14:48:29 +02:00 committed by GitHub
commit c6d36b97ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 17 deletions

View File

@ -4533,9 +4533,10 @@ do_arg_all (
use_firstwin = true; use_firstwin = true;
} }
for (i = 0; i < count && i < opened_len && !got_int; ++i) { for (i = 0; i < count && i < opened_len && !got_int; i++) {
if (alist == &global_alist && i == global_alist.al_ga.ga_len - 1) if (alist == &global_alist && i == global_alist.al_ga.ga_len - 1) {
arg_had_last = TRUE; arg_had_last = true;
}
if (opened[i] > 0) { if (opened[i] > 0) {
/* Move the already present window to below the current window */ /* Move the already present window to below the current window */
if (curwin->w_arg_idx != i) { if (curwin->w_arg_idx != i) {

View File

@ -14664,6 +14664,7 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
static char *e_invact = N_("E927: Invalid action: '%s'"); static char *e_invact = N_("E927: Invalid action: '%s'");
const char *title = NULL; const char *title = NULL;
int action = ' '; int action = ' ';
static int recursive = 0;
rettv->vval.v_number = -1; rettv->vval.v_number = -1;
dict_T *d = NULL; dict_T *d = NULL;
@ -14671,6 +14672,9 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
if (list_arg->v_type != VAR_LIST) { if (list_arg->v_type != VAR_LIST) {
EMSG(_(e_listreq)); EMSG(_(e_listreq));
return; return;
} else if (recursive != 0) {
EMSG(_(e_au_recursive));
return;
} }
typval_T *action_arg = &args[1]; typval_T *action_arg = &args[1];
@ -14712,10 +14716,12 @@ skip_args:
title = (wp ? "setloclist()" : "setqflist()"); title = (wp ? "setloclist()" : "setqflist()");
} }
recursive++;
list_T *const l = list_arg->vval.v_list; list_T *const l = list_arg->vval.v_list;
if (set_errorlist(wp, l, action, (char_u *)title, d) == OK) { if (set_errorlist(wp, l, action, (char_u *)title, d) == OK) {
rettv->vval.v_number = 0; rettv->vval.v_number = 0;
} }
recursive--;
} }
/* /*

View File

@ -6536,6 +6536,13 @@ void alist_expand(int *fnum_list, int fnum_len)
void alist_set(alist_T *al, int count, char_u **files, int use_curbuf, int *fnum_list, int fnum_len) void alist_set(alist_T *al, int count, char_u **files, int use_curbuf, int *fnum_list, int fnum_len)
{ {
int i; int i;
static int recursive = 0;
if (recursive) {
EMSG(_(e_au_recursive));
return;
}
recursive++;
alist_clear(al); alist_clear(al);
ga_grow(&al->al_ga, count); ga_grow(&al->al_ga, count);
@ -6560,8 +6567,10 @@ void alist_set(alist_T *al, int count, char_u **files, int use_curbuf, int *fnum
xfree(files); xfree(files);
} }
if (al == &global_alist) if (al == &global_alist) {
arg_had_last = FALSE; arg_had_last = false;
}
recursive--;
} }
/* /*

View File

@ -528,8 +528,8 @@ EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer
*/ */
EXTERN alist_T global_alist; /* global argument list */ EXTERN alist_T global_alist; /* global argument list */
EXTERN int max_alist_id INIT(= 0); ///< the previous argument list id EXTERN int max_alist_id INIT(= 0); ///< the previous argument list id
EXTERN int arg_had_last INIT(= FALSE); /* accessed last file in EXTERN bool arg_had_last INIT(= false); // accessed last file in
global_alist */ // global_alist
EXTERN int ru_col; /* column for ruler */ EXTERN int ru_col; /* column for ruler */
EXTERN int ru_wid; /* 'rulerfmt' width of ruler when non-zero */ EXTERN int ru_wid; /* 'rulerfmt' width of ruler when non-zero */
@ -1099,6 +1099,8 @@ EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name")); EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
EXTERN char_u e_dirnotf[] INIT(= N_( EXTERN char_u e_dirnotf[] INIT(= N_(
"E919: Directory not found in '%s': \"%s\"")); "E919: Directory not found in '%s': \"%s\""));
EXTERN char_u e_au_recursive[] INIT(= N_(
"E952: Autocommand caused recursive behavior"));
EXTERN char_u e_unsupportedoption[] INIT(= N_("E519: Option not supported")); EXTERN char_u e_unsupportedoption[] INIT(= N_("E519: Option not supported"));
EXTERN char_u e_fnametoolong[] INIT(= N_("E856: Filename too long")); EXTERN char_u e_fnametoolong[] INIT(= N_("E856: Filename too long"));
EXTERN char_u e_float_as_string[] INIT(= N_("E806: using Float as a String")); EXTERN char_u e_float_as_string[] INIT(= N_("E806: using Float as a String"));

View File

@ -1624,9 +1624,10 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
win_close(curwin, true); win_close(curwin, true);
advance = false; advance = false;
} }
if (arg_idx == GARGCOUNT - 1) if (arg_idx == GARGCOUNT - 1) {
arg_had_last = TRUE; arg_had_last = true;
++arg_idx; }
arg_idx++;
} }
os_breakcheck(); os_breakcheck();
if (got_int) { if (got_int) {

View File

@ -2434,7 +2434,7 @@ did_set_string_option (
int did_chartab = FALSE; int did_chartab = FALSE;
char_u **gvarp; char_u **gvarp;
bool free_oldval = (options[opt_idx].flags & P_ALLOCED); bool free_oldval = (options[opt_idx].flags & P_ALLOCED);
int ft_changed = false; bool value_changed = false;
/* Get the global option to compare with, otherwise we would have to check /* Get the global option to compare with, otherwise we would have to check
* two values for all local options. */ * two values for all local options. */
@ -3155,11 +3155,13 @@ did_set_string_option (
if (!valid_filetype(*varp)) { if (!valid_filetype(*varp)) {
errmsg = e_invarg; errmsg = e_invarg;
} else { } else {
ft_changed = STRCMP(oldval, *varp) != 0; value_changed = STRCMP(oldval, *varp) != 0;
} }
} else if (gvarp == &p_syn) { } else if (gvarp == &p_syn) {
if (!valid_filetype(*varp)) { if (!valid_filetype(*varp)) {
errmsg = e_invarg; errmsg = e_invarg;
} else {
value_changed = STRCMP(oldval, *varp) != 0;
} }
} else if (varp == &curwin->w_p_winhl) { } else if (varp == &curwin->w_p_winhl) {
if (!parse_winhl_opt(curwin)) { if (!parse_winhl_opt(curwin)) {
@ -3235,14 +3237,28 @@ did_set_string_option (
*/ */
/* When 'syntax' is set, load the syntax of that name */ /* When 'syntax' is set, load the syntax of that name */
if (varp == &(curbuf->b_p_syn)) { if (varp == &(curbuf->b_p_syn)) {
apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, static int syn_recursive = 0;
curbuf->b_fname, TRUE, curbuf);
syn_recursive++;
// Only pass true for "force" when the value changed or not used
// recursively, to avoid endless recurrence.
apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, curbuf->b_fname,
value_changed || syn_recursive == 1, curbuf);
syn_recursive--;
} else if (varp == &(curbuf->b_p_ft)) { } else if (varp == &(curbuf->b_p_ft)) {
// 'filetype' is set, trigger the FileType autocommand // 'filetype' is set, trigger the FileType autocommand
if (!(opt_flags & OPT_MODELINE) || ft_changed) { // Skip this when called from a modeline and the filetype was
// already set to this value.
if (!(opt_flags & OPT_MODELINE) || value_changed) {
static int ft_recursive = 0;
ft_recursive++;
did_filetype = true; did_filetype = true;
apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, // Only pass true for "force" when the value changed or not
curbuf->b_fname, true, curbuf); // used recursively, to avoid endless recurrence.
apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, curbuf->b_fname,
value_changed || ft_recursive == 1, curbuf);
ft_recursive--;
// Just in case the old "curbuf" is now invalid // Just in case the old "curbuf" is now invalid
if (varp != &(curbuf->b_p_ft)) { if (varp != &(curbuf->b_p_ft)) {
varp = NULL; varp = NULL;